1
0
mirror of synced 2025-02-10 17:29:27 +03:00

Check for non-cacheable associations directly on the class metada info

This commit is contained in:
Asmir Mustafic 2015-06-20 13:37:09 +02:00
parent 6a428c6064
commit c685255fe3

View File

@ -28,6 +28,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use ReflectionClass; use ReflectionClass;
use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\ClassLoader; use Doctrine\Common\ClassLoader;
use Doctrine\ORM\Cache\CacheException;
/** /**
* A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata * A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata
@ -1486,6 +1487,10 @@ class ClassMetadataInfo implements ClassMetadata
if ( ! $this->isIdentifierComposite && count($this->identifier) > 1) { if ( ! $this->isIdentifierComposite && count($this->identifier) > 1) {
$this->isIdentifierComposite = true; $this->isIdentifierComposite = true;
} }
if ($this->cache && !isset($mapping['cache'])) {
throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']);
}
} }
// Mandatory attributes for both sides // Mandatory attributes for both sides