Closed nmateo closed 4 years ago
Sorry for the code blocks, it doesnt work..
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.
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.
hey thanks, i got this in my composer.lock: "doctrine/orm": "^2.5",
The composer show command grep doctrine give me this:
I also got this composer.json here in vendor/sonata-project/admin-bundle/composer.json:
{ "name": "sonata-project/admin-bundle", "type": "symfony-bundle", "description": "The missing Symfony Admin Generator", "keywords": [ "Admin Generator", "admin", "sonata", "bootstrap" ], "homepage": "https://sonata-project.org/bundles/admin", "license": "MIT", "authors": [ { "name": "Thomas Rabaix", "email": "thomas.rabaix@sonata-project.org", "homepage": "https://sonata-project.org" }, { "name": "Sonata Community", "homepage": "https://github.com/sonata-project/SonataAdminBundle/contributors" } ], "require": { "php": "^5.6 || ^7.0", "doctrine/common": "^2.7", "doctrine/inflector": "^1.1", "knplabs/knp-menu-bundle": "^2.2", "sonata-project/block-bundle": "^3.11", "sonata-project/core-bundle": "^3.9", "sonata-project/exporter": "^1.8", "symfony/asset": "^2.8 || ^3.2 || ^4.0", "symfony/config": "^2.8 || ^3.2 || ^4.0", "symfony/console": "^2.8 || ^3.2 || ^4.0", "symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0", "symfony/event-dispatcher": "^2.8 || ^3.2 || ^4.0", "symfony/expression-language": "^2.8 || ^3.2 || ^4.0", "symfony/form": "^2.8 || ^3.2 || ^4.0", "symfony/framework-bundle": "^2.8 || ^3.2 || ^4.0", "symfony/http-foundation": "^2.8 || ^3.2 || ^4.0", "symfony/http-kernel": "^2.8 || ^3.2 || ^4.0", "symfony/options-resolver": "^2.8 || ^3.2 || ^4.0", "symfony/property-access": "^2.8 || ^3.2 || ^4.0", "symfony/routing": "^2.8 || ^3.2 || ^4.0", "symfony/security-acl": "^2.8 || ^3.0", "symfony/security-bundle": "^2.8 || ^3.2 || ^4.0", "symfony/security-core": "^2.8 || ^3.2 || ^4.0", "symfony/security-csrf": "^2.8 || ^3.2 || ^4.0", "symfony/templating": "^2.8 || ^3.2 || ^4.0", "symfony/translation": "^2.8 || ^3.2 || ^4.0", "symfony/twig-bridge": "^2.8 || ^3.2 || ^4.0", "symfony/twig-bundle": "^2.8 || ^3.2 || ^4.0", "symfony/validator": "^2.8 || ^3.2 || ^4.0", "twig/extensions": "^1.5", "twig/twig": "^1.34 || ^2.0" },"conflict": { "jms/di-extra-bundle": "<1.9", "sonata-project/media-bundle": "<3.7", "sonata-project/user-bundle": "<3.3" }, "require-dev": { "jms/di-extra-bundle": "^1.9", "jms/translation-bundle": "^1.4", "matthiasnoback/symfony-dependency-injection-test": "^1.1", "sensio/generator-bundle": "^3.1", "sonata-project/intl-bundle": "^2.4", "symfony/class-loader": "^2.8 || ^3.2", "symfony/filesystem": "^2.8 || ^3.2 || ^4.0", "symfony/phpunit-bridge": "^4.0", "symfony/yaml": "^2.8 || ^3.2 || ^4.0" }, "suggest": { "jms/di-extra-bundle": "Annotations for Admin definition", "jms/translation-bundle": "Extract message keys from Admins", "sensio/generator-bundle": "Add sonata:admin:generate command", "sonata-project/intl-bundle": "Add localized date and number into the list" }, "config": { "sort-packages": true }, "extra": { "branch-alias": { "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { "Sonata\AdminBundle\": "src/" } }, "autoload-dev": { "psr-4": { "Sonata\AdminBundle\Tests\": "tests/" } } }
I think this is prob a problem of versioning/compatibillity right ?
No, probably something else. Have you tried reducing this to just the affected fields? What happens if you run orm:info
with this entity and just the identifier plus the two boolean fields?
composer show
gives version 2.6.2 for this package (doctrine/orm
) :+1:
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.
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) ?
Thanks @Ocramius. The php bin/console orm:info gives me nothing but an undefined command.
Maybe doctrine:info
? No idea how this is done in symfony :-P
Thanks Ocramius, got this:
Maybe orm:mapping:describe
(doctrine:mapping:describe
in 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
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
And no caches involved?
And no caches involved?
Especially metadata cache.
I cleared all caches including doctrine metadata multiples times
I got an error generating the dump of doctrine metadata here it is:
Thanks for the help it's now resolved after upgrading some dependencies and clearing caches it works great thanks again for the help!
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