mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Not detected new mapped field #6336
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nmateo on GitHub (Oct 28, 2019).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
I tried to map a field exactly as the same as one another in my entity, when running:
php bin/console doctrine:schema:update --dump-sql

or
php bin/console doctrine:schema:update --force
i got this: [OK] Nothing to update - your database is already in sync with the current entity metadata.
And the field is fine in the database:
Te field is "promoted", same as "certified", same behavior expected.
Current behavior
In practice, whenever i try to work with the field "promoted" the same way as i do with the field "certified", it says there's no mapped field "promoted".
How to reproduce
BaseListing.php:
Expected behavior
I excepted doctrine to query for "promoted" the same way as "certified", instead, it says it is'nt mapped, for more info, here's my post on stack overflow: https://stackoverflow.com/questions/58504171/why-isnt-my-property-mapped-to-the-entity
@nmateo commented on GitHub (Oct 28, 2019):
Sorry for the code blocks, it doesnt work..
@lcobucci commented on GitHub (Oct 28, 2019):
Did you perhaps have a typo in the version you're using? If not, is this reproducible on the latest version of the ORM (v2.6.4)? v2.4 is pretty much ancient and no longer maintained.
@nmateo commented on GitHub (Oct 29, 2019):
hey thanks, i got this in my composer.lock: "doctrine/orm": "^2.5",
@nmateo commented on GitHub (Oct 29, 2019):
The composer show command grep doctrine give me this:
@nmateo commented on GitHub (Oct 29, 2019):
I also got this composer.json here in vendor/sonata-project/admin-bundle/composer.json:
@nmateo commented on GitHub (Oct 29, 2019):
I think this is prob a problem of versioning/compatibillity right ?
@Ocramius commented on GitHub (Oct 29, 2019):
No, probably something else. Have you tried reducing this to just the affected fields? What happens if you run
orm:infowith this entity and just the identifier plus the two boolean fields?@lcobucci commented on GitHub (Oct 29, 2019):
composer showgives version 2.6.2 for this package (doctrine/orm) 👍Your mapping seems okay (a bit convoluted, though).
I'd suggest updating to the latest ORM
v2.6.4(just to ensure you have the latest bugfixes - none related to this specifically) and to isolate the ORM behaviour from the rest - you have many things being integrated (various traits and usage of SF forms).That isolation could be done by instantiating the object, persisting it (persist + flush), and fetching it from the DB (clear + find). This process would show if the ORM is the culprit here.
@nmateo commented on GitHub (Oct 29, 2019):
Updated to 2.6.4 Thanks @lcobucci. Could you show me a little bit how to instantiating the object, persisting it (persist + flush), and fetching it from the DB (clear + find) ?
@nmateo commented on GitHub (Oct 29, 2019):
Thanks @Ocramius. The php bin/console orm:info gives me nothing but an undefined command.
@Ocramius commented on GitHub (Oct 29, 2019):
Maybe
doctrine:info? No idea how this is done in symfony :-P@nmateo commented on GitHub (Oct 29, 2019):
Thanks Ocramius, got this:

@Ocramius commented on GitHub (Oct 29, 2019):
Maybe
orm:mapping:describe(doctrine:mapping:describein symfony context?) will help further.Closing here meanwhile: as mentioned above, you have to isolate the issue by reducing the code until the minimum reproducible scenario, without the rest of the application code.
Once it is clear if/that it is an ORM bug, then please re-open with a more reduced example, maybe to be added to https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket
@nmateo commented on GitHub (Oct 29, 2019):
I can assure you it's a doctrine-orm issue since it tells me all is up to date and when i try to use my field suddenly it says it is not mapped, i manage to get a mapping description with: php bin/console sonata:core:dump-doctrine-metadata
@Ocramius commented on GitHub (Oct 29, 2019):
And no caches involved?
@lcobucci commented on GitHub (Oct 29, 2019):
Especially metadata cache.
@nmateo commented on GitHub (Oct 29, 2019):
I cleared all caches including doctrine metadata multiples times
@nmateo commented on GitHub (Oct 29, 2019):
I got an error generating the dump of doctrine metadata here it is:
@nmateo commented on GitHub (Oct 29, 2019):
Thanks for the help it's now resolved after upgrading some dependencies and clearing caches it works great thanks again for the help!