Releases: cycle/annotated
v4.2.0
v4.1.0
v3.5.0
v4.0.0
What's Changed
- Logic for entity detection has been rewritten using Tokenizer Listeners by @msmakouz in #60
doctrine/annotations
has been moved to therequire-dev
section 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
AttributeReader
was 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
ForeignKey
attribute 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, aUser
entity 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
MergeColumns
generator by @msmakouz in #72 - Add
readonlySchema
to theColumn
annotation 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
smallInteger
type hint to theColumn
attribute by @gam6itko in #52 - Extend supporting for
doctrine/annotations
to 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
morphKey
default value by @roxblnfk in (#50)
New Contributors
Full Changelog: v3.0.0...v3.1.0