-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
readonly support for identifiers #353
Comments
I've definitely seem some problems with readonly properties in doctrine that aren't fixed. Are you sure this is foundry-specific? What's the code that causes the problem? $object = FooFactory::create(); // ?
$object->id; // ?
$object->title; // ?
|
Does this work as expected (no foundry code): $foo = new Foo(new Title('foo...));
$em->persist($foo);
$em->flush();
$em->refresh($foo);
|
Hi Kevin i tested this without problems. Let me check refresh works or not.
|
refresh works |
Ok thanks, I'll have to dig into this. |
Per a slack conversation with @benblub, it does not. I think:
Could be related |
In my experience, |
If you use readonly on the id/identifier an error is thrown. Use readonly on
$title
works as expected.if we take a look into the code where the error is thrown..
if we look into the comparison, values are the same, so the object instance is not the same
Stacktrace
Model/Entity
Factory
i didn't looked yet deep dive into the code how foundry instantiate the object and whats the different there between normal props and the identifier. With PHP 8.2 we get immutable classes, this examble used readonly probs -> PHP 8.1
https://stitcher.io/blog/php-81-readonly-properties
The text was updated successfully, but these errors were encountered: