|
|
@ -5,6 +5,8 @@ namespace BitCommunism\Doctrine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use DI\Container;
|
|
|
|
use DI\Container;
|
|
|
|
|
|
|
|
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
|
|
|
|
|
|
|
use Doctrine\Common\Persistence\ObjectRepository;
|
|
|
|
use Doctrine\ORM\Tools\Setup;
|
|
|
|
use Doctrine\ORM\Tools\Setup;
|
|
|
|
|
|
|
|
|
|
|
|
class ContextAwareEntityManager implements EntityManager
|
|
|
|
class ContextAwareEntityManager implements EntityManager
|
|
|
@ -70,6 +72,10 @@ class ContextAwareEntityManager implements EntityManager
|
|
|
|
|
|
|
|
|
|
|
|
$entityPaths = $this->container->get($fullEntityPathKey);
|
|
|
|
$entityPaths = $this->container->get($fullEntityPathKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_array($entityPaths)) {
|
|
|
|
|
|
|
|
$entityPaths = [$entityPaths];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($entityPaths as $entityPath) {
|
|
|
|
foreach ($entityPaths as $entityPath) {
|
|
|
|
$this->entityManagerPathMap[$entityPath] = $name;
|
|
|
|
$this->entityManagerPathMap[$entityPath] = $name;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -246,12 +252,12 @@ class ContextAwareEntityManager implements EntityManager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getRepository($className)
|
|
|
|
public function getRepository($className): ObjectRepository
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->getEntityManagerForClass($className)->getRepository($className);
|
|
|
|
return $this->getEntityManagerForClass($className)->getRepository($className);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getClassMetadata($className)
|
|
|
|
public function getClassMetadata($className): ClassMetadata
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->getEntityManagerForClass($className)->getClassMetadata($className);
|
|
|
|
return $this->getEntityManagerForClass($className)->getClassMetadata($className);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -261,7 +267,7 @@ class ContextAwareEntityManager implements EntityManager
|
|
|
|
return $this->getEntityManagerForObject($object)->initializeObject($object);
|
|
|
|
return $this->getEntityManagerForObject($object)->initializeObject($object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function contains($object)
|
|
|
|
public function contains($object): bool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->getEntityManagerForObject($object)->contains($object);
|
|
|
|
return $this->getEntityManagerForObject($object)->contains($object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|