mevdschee / mevdschee/php-crud-api

Using Customization handler to insert app-generated ID

Open
#1,021 11 comments 0 reactions 1 assignee View on GitHub

@mevdschee is already working on this.

Since Mar 10, 2024.

help wanted
Dominant language
PHP
Stars
3.7k
Forks
1k
Avg merge
1h 55m
Merged PRs (30d)
7

Description

I was just trying to use Universally Unique Lexicographically Sortable Identifier ULID with this library and was able to insert the ULID via the multitenancy middleware as follows:

	'multiTenancy.handler' => function ($operation, $tableName) {
			if($operation =='create' && $tableName=='data'){ 
				return['id'=>Ulid::generate()];
			}
		},

With SQLite, the post request is ok (data is saved and response status is HTTP 200) but returns {} or an empty array. Any idea why?

SQLite table schema:

CREATE TABLE data (
    id        TEXT (26) PRIMARY KEY
                        NOT NULL,
    content      TEXT,
    createdAt DATETIME  NOT NULL
                        DEFAULT (strftime('%Y-%m-%d %H:%M:%fZ') ) 
);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.