Size restrictions for string/int types #9

Open
opened 2026-08-02 14:47:58 +02:00 by c.fahner · 0 comments
Owner

Currently databases have to declare string and int types using the maximum size available to them.

The String_ and Int_ types should be made public, be declarable as attributes, and introduce a "max length" property. The String_ type should enforce a default max length (breaking change!) and also keep supporting infinite length (use the INF constant, since it is clearer than having a 0 sentinel value).

The Schema class should be changed to accomodate types being declared as attributes, which override the PHP-declared type.

The same should be done for the Blob type, if #7 is implemented by then.

Update:
Separate the namespaces: Slendium\Ocd\Schema\Types contains type implementations and Slendium\Ocd\Schema\Type contains additional interfaces for types to optionally support.

An interface Type\Sized would be implemented by the string and int types.

Currently databases have to declare `string` and `int` types using the maximum size available to them. The `String_` and `Int_` types should be made public, be declarable as attributes, and introduce a "max length" property. The `String_` type should enforce a default max length (breaking change!) and also keep supporting infinite length (use the `INF` constant, since it is clearer than having a `0` sentinel value). The `Schema` class should be changed to accomodate types being declared as attributes, which override the PHP-declared type. The same should be done for the `Blob` type, if #7 is implemented by then. **Update**: Separate the namespaces: `Slendium\Ocd\Schema\Types` contains type **implementations** and `Slendium\Ocd\Schema\Type` contains additional interfaces for types to optionally support. An interface `Type\Sized` would be implemented by the string and int types.
c.fahner added this to the v0.2 milestone 2026-08-20 19:51:30 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
Reference
slendium/ocd#9
No description provided.