-
-
Notifications
You must be signed in to change notification settings - Fork 190
BUGFIX: Support ORM attributes #3508
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
base: 8.4
Are you sure you want to change the base?
Conversation
|
This does not yet work – whether this "minimally invasive" approach is feasible is yet to be proven… |
b4e3c87 to
07c4739
Compare
|
@mficzel Using the reflection service in our own reader implementation works. If our assumptions are correct, new tests should pass, too. |
|
@kdambekalns something is still fishy ... |
|
I wonder wether we also have to adjust |
|
Making |
|
Doh… I removed all the adjusted entities except #[Flow\Entity]
class AnnotatedIdEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\SequenceGenerator(sequenceName: 'annotatedidentity_seq')]
protected string $id;But this does work: #[Flow\Entity]
class AnnotatedIdEntity
{
/** @var string */
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\SequenceGenerator(sequenceName: 'annotatedidentity_seq')]
protected string $id;The missing |
|
We should think about targeting Neos 8.4 + PHP 8.2 as i noticed that in Neos 8.3 with PHP 8.0 we:
|
|
Checked Neos 8.4 and the proxy builder still destroys nested attributes. Created #3511 for that. |
|
I am confused. Locally this PR passes on PHP 8.3 if I add this: How does this relate to broken attribute rendering?
|
|
I tried rebasing this pr to 8.4 and together with the changes from #3512 i could successfully define a repository and entity via attributes. However the properties in the entity were not detected unless i added the @var annotation. So this problem persists even in 8.4. However it looks like it might really be the last real problem as the proxy classes were successfully created otherwise and flow did not complain about anything. |
That's great news already! |
# Conflicts: # Neos.Flow/Tests/Functional/Persistence/Aspect/PersistenceMagicAspectTest.php
The Doctrine reader exclusively used annotations, our reflection service also takes attributes into account. This should allow to use both for configuring ORM.
This is here to demonstrate that the tests can succeed and are a 1:1 copy of the classic fixtures.
Without this change, any class property is ignored, if it has no `@var` tag. As soon as a property lacks that tag, the early return in method `evaluateClassPropertyAnnotationsForSchema` kicks in. When using type declarations, this is nonsense, though. This change thus makes sure the type is fetched from the native type declaration if no `@var` tag is found. If a `@var` tag exists, it takes precedence. This allows to do things like this to declare typed collections: ```php /** * @var Collection<AnnotatedIdentitiesEntity> */ #[ORM\ManyToMany(indexBy: 'author')] protected Collection $annotatedIdentitiesEntities; ```
02747ea to
6b049a0
Compare
The ``json_array`` type is removed in Doctrine DBAL 3.0.
This allows complex return types like `ArrayCollection|Collection` or `static`.
|
🎉 |
Hopefully fixes #2602 and allows to use PHP attributes to configure Doctrine ORM, not only annotations like before.
Upgrade instructions
No change should be needed.
Checklist
FEATURE|TASK|BUGFIXReviewer - Breaking Changes are marked with!!!and have upgrade-instructions