Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register types with a PHP attribute #107

Closed
4 tasks
brotkrueml opened this issue Feb 14, 2023 · 0 comments
Closed
4 tasks

Register types with a PHP attribute #107

brotkrueml opened this issue Feb 14, 2023 · 0 comments
Assignees
Labels
breaking Breaking changes in major release documentation Improvements or additions to documentation
Milestone

Comments

@brotkrueml
Copy link
Owner

brotkrueml commented Feb 14, 2023

Currently, the types are registered in Configuration/TxSchema/ folder in an array. With the availability with attributes since PHP 8.0 these can be used to register the types.

  • An attribute is available to tag a class as a type implementation.
  • The previously used Configuration/TxSchema/TypeModels.php is not considered anymore.
  • The migration is documented.
  • A breaking entry in the changelog is available.
@brotkrueml brotkrueml added documentation Improvements or additions to documentation breaking Breaking changes in major release labels Feb 14, 2023
@brotkrueml brotkrueml added this to the Version 3.0 milestone Feb 14, 2023
@brotkrueml brotkrueml self-assigned this Feb 14, 2023
brotkrueml added a commit that referenced this issue Oct 14, 2023
With #107 registering types via the PHP attribute `Brotkrueml\Schema\Attributes\Type`
was introduced to decouple the class name from the type. However, the
AbstractType->getType() method still checks for the class name (and has
a logic when a type starts with a number and therefore the class starts with
an underscore).

Now the attribute is taken into account. To speed up the determination of the type,
a static property is introduced which caches already resolved types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking changes in major release documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant