mevdschee / mevdschee/php-crud-api
Using Customization handler to insert app-generated ID
Open
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.