Releases: cycle/annotated
v3.5.0
v4.0.0
What's Changed
- Logic for entity detection has been rewritten using Tokenizer Listeners by @msmakouz in #60
doctrine/annotationshas been moved to therequire-devsection by @msmakouz in #73- The minimum PHP version has been raised to 8.1 by @msmakouz in #81
- Removed deprecated code by @msmakouz in #83
AttributeReaderwas set as the default reader by @msmakouz in #93
Full Changelog: v3.4.0...v4.0.0
v3.4.0
What's Changed
- Removing unused import by @msmakouz in #90
- Expose a Foreign Key definition via the new
ForeignKeyattribute by @msmakouz in #91
Foreign Key declaration via attributes
Now, you can easily define foreign keys in your entity classes using attributes, without needing any relation definitions.
How It Works:
-
Define Entities using the
#[Entity]attribute. For example, aUserentity can be created with an ID as the primary key.use Cycle\Annotated\Annotation\Entity; use Cycle\Annotated\Annotation\Column; #[Entity] class User { #[Column(type: 'primary')] public int $id; }
-
Set up Foreign Keys in two ways:
-
Directly on Properties: You can annotate a property in your class to indicate it's a foreign key related to another entity.
use Cycle\Annotated\Annotation\Entity; use Cycle\Annotated\Annotation\ForeignKey; #[Entity] class Post { // ... #[Column(type: 'integer')] #[ForeignKey(target: User::class, action: 'CASCADE')] private int $userId; }
-
Or, on the Class Itself: Alternatively, you can place the foreign key annotation at the class level, specifying details like which property in your class is the foreign key (
innerKey), and which property in the related class it corresponds to (outerKey).use Cycle\Annotated\Annotation\Entity; use Cycle\Annotated\Annotation\ForeignKey; #[Entity] #[ForeignKey(target: User::class, innerKey: 'userId', outerKey: 'id', action: 'CASCADE')] class Post { // ... #[Column(type: 'integer')] private int $userId; }
Full Changelog: v3.3.1...v3.4.0
v3.3.1
v3.3.0
What's Changed
- Describe new column types in
#[Column]expected values by @msmakouz in #70 - Add ability to define any column attributes by @roxblnfk and @gam6itko in #53
- Add ability to parse parent class attributes in the
MergeColumnsgenerator by @msmakouz in #72 - Add
readonlySchemato theColumnannotation by @msmakouz in #75
Full Changelog: v3.2.1...v3.3.0
v3.2.1
What's Changed
- Fix that the JTI parent has fields from children by @msmakouz in #65 thx @kastahov for tests in #64
- Add
smallIntegertype hint to theColumnattribute by @gam6itko in #52 - Extend supporting for
doctrine/annotationsto version 2.0 by @msmakouz in #66 - Fix bug #54 when children were not added on using attributes without dockblock by @makedo in #55
New Contributors
Full Changelog: v3.2.0...v3.2.1
3.2.0
3.1.0
What's Changed
- Add test cases related to different relation field definitions by @roxblnfk (#44)
- Add prefix parameter to Embedded by @msmakouz (#46)
- Add Foreign Keys for JTI by @msmakouz in (#43)
- Fix comment to the Column field 'typecast' by @roquie (#49)
- Fix error related with
morphKeydefault value by @roxblnfk in (#50)
New Contributors
Full Changelog: v3.0.0...v3.1.0
3.0.0
What's Changed
- Introduce
PrimaryKeyclass level annotation for composite pkeys by @rauanmayemir in #19 - Deprecate
though, addthroughannotation stubs by @rauanmayemir in #20 - Rename constrain to scope;
- Add composite keys supporting by @roxblnfk in #26
- Replaced Spiral\Database with Cycle\Database by @butschster in #22
- Support custom collection and entity typecast handlers by @butschster in #29
- Add supporting for SchemaModifiers annotations in Entities by @roxblnfk in #30
- Adds STI/JTI support by @butschster in #31
- Replaces Annotation\Attributes with Annotation\NamedArgumentConstructor for all Annotation classes by @butschster in #34
- Rearranged tests structure by @butschster in #35
New Contributors
- @butschster made their first contribution in #22
- @msmakouz made their first contribution in #28
Full Changelog: v2.3.1...v3.0.0