-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Not all ClassMetadata is loaded in prod #8866
Comments
Could it be that your metadata cache is not cleared? |
No, clearing cache is a first thing I do if any troubles |
In case you are using php-fpm or another server, please try restarting it too. I see you are using |
This could be a bug, |
I havent' checked that yet. But I think I was debugging this issue using it the same dev docker image without opcache... The only difference was |
@beberlei I reported this strange behavior concerning the It was ultimately recommended to use |
So as I getting more of this kind of problems.. and they are successfully bypassing our automated tests,
In So you either
if (is_object($value) && $this->metadataFactory->hasMetadataFor(ClassUtils::getClass($value))) {
$id[$i] = $this->unitOfWork->getSingleIdentifierValue($value); Maybe the orm/lib/Doctrine/ORM/EntityManager.php Line 431 in 203cd6e
class ServiceEntityRepository extends EntityRepository implements ServiceEntityRepositoryInterface
{
public function __construct(ManagerRegistry $registry, string $entityClass)
{
$manager = $registry->getManagerForClass($entityClass);
parent::__construct($manager, $manager->getClassMetadata($entityClass));
}
} When I call However when I call it with already warmed up cache it will only load the host class, and embedables (which are listed in host class metadata) will not be handled: Maybe a quick fix solution would be to make this method load embeded classes from cache with it's host's data. |
Who can I ping for some feedback? |
I am facing the same problem right now. The problem for me is that https://github.com/doctrine/persistence/blob/3.0.x/src/Persistence/Mapping/AbstractClassMetadataFactory.php#L188 doesn't set parent classes as loaded and But if it misses the cache it loads the metadata for the whole hierarchy of classes. |
for me the error occurs when gedmo/extensions loads the metadata to check if it is configured, I could narrow it down to the release 3.7.0. As far as I understood: They removed doctrine/cache to use a custom cache, that might be the problem on their side then. (doctrine-extensions/DoctrineExtensions@v3.6.0...v3.7.0) |
Have an
Id
as an embeded object:Using in a repository like that:
Works in dev environment, but in prod environment it somehow converts any Id object to flat int
1
value without any error or exception.Digging further somewhere here in
EntityManager
we have identifier resolution forfind()
method:Inside highlited line we have the following situation for
dev
:However for
prod
loadedMetadata
is different:It seems like in
prod
not all class metadata is loaded.Can't figure out why?
And why Doctrine doesn't throw an error when it sees object as an indentifier and can't find metadata for it?
The same is true for
->findBy([])
method, but->hasMetadataFor
is called inBaseEntityPersister::getValues()
.doctrine/doctrine-bundle: 2.4.2
doctrine/orm: 2.9.3
doctrine/orm: 3
doctrine/persistence: 2.2.1
The text was updated successfully, but these errors were encountered: