本文整理汇总了PHP中Doctrine\Common\Persistence\ObjectManager::getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManager::getConfiguration方法的具体用法?PHP ObjectManager::getConfiguration怎么用?PHP ObjectManager::getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Persistence\ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::getConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Test setup
*/
protected function setUp()
{
// setup entity aliases
$this->em = DoctrineTestHelper::createTestEntityManager();
$entityManagerNamespaces = $this->em->getConfiguration()->getEntityNamespaces();
$entityManagerNamespaces['WebtownPhpBannerBundle'] = 'WebtownPhp\\BannerBundle\\Entity';
$this->em->getConfiguration()->setEntityNamespaces($entityManagerNamespaces);
// setup schema
$schemaTool = new SchemaTool($this->em);
$classes = [];
foreach ($this->getEntities() as $entityClass) {
$classes[] = $this->em->getClassMetadata($entityClass);
}
try {
$schemaTool->dropSchema($classes);
} catch (\Exception $e) {
}
try {
$schemaTool->createSchema($classes);
} catch (\Exception $e) {
}
$registry = \Mockery::mock('Doctrine\\Bundle\\DoctrineBundle\\Registry');
$registry->shouldReceive('getManager')->andReturn($this->em);
$this->bm = new ORMManager($registry, new EventDispatcher());
}
示例2: __construct
/**
* Initializes extension driver
*
* @param ObjectManager $objectManager
* @param string $extensionNamespace
* @param object $annotationReader
*/
public function __construct(ObjectManager $objectManager, $extensionNamespace, $annotationReader)
{
$this->objectManager = $objectManager;
$this->annotationReader = $annotationReader;
$this->extensionNamespace = $extensionNamespace;
$omDriver = $objectManager->getConfiguration()->getMetadataDriverImpl();
$this->driver = $this->getDriver($omDriver);
}
示例3: getSubClasses
/**
* @param string $class
* @param ObjectManager $om
* @return array
*/
private function getSubClasses($class, ObjectManager $om)
{
$classes = [];
foreach ($om->getConfiguration()->getMetadataDriverImpl()->getAllClassNames() as $className) {
if (is_subclass_of($className, $class, true)) {
$classes[] = $className;
}
}
return $classes;
}
示例4: getEntityStatus
/**
* Returns information about which entities exist and possibly if their
* mapping information contains errors or not.
*
* @return array
*/
public function getEntityStatus()
{
$entityClassNames = $this->entityManager->getConfiguration()->getMetadataDriverImpl()->getAllClassNames();
$info = array();
foreach ($entityClassNames as $entityClassName) {
try {
$info[$entityClassName] = $this->entityManager->getClassMetadata($entityClassName);
} catch (\Doctrine\ORM\Mapping\MappingException $e) {
$info[$entityClassName] = $e->getMessage();
}
}
return $info;
}
示例5: __construct
/**
* Initializes extension driver.
*
* @param \Doctrine\Common\Persistence\ObjectManager $objectManager
* @param string $extensionNamespace
* @param object $annotationReader
*/
public function __construct(ObjectManager $objectManager, $extensionNamespace, $annotationReader)
{
$this->objectManager = $objectManager;
$this->annotationReader = $annotationReader;
$this->extensionNamespace = $extensionNamespace;
$omDriver = $objectManager->getConfiguration()->getMetadataDriverImpl();
$omCache = $this->objectManager->getMetadataFactory()->getCacheDriver();
$metadataClassName = null;
if (class_exists($this->extensionNamespace . '\\Mapping\\ClassMetadata')) {
$metadataClassName = $this->extensionNamespace . '\\Mapping\\ClassMetadata';
}
$driver = $this->getDriver($omDriver);
$driver->setBaseMetadataFactory($objectManager->getMetadataFactory());
parent::__construct($driver, $omCache, $extensionNamespace, $metadataClassName);
}
示例6: getSql
/**
* @param DoctrineSqlFilter $sqlFilter
* @param ClassMetadata $targetEntity
* @param string $targetTableAlias
* @return string
* @throws InvalidQueryRewritingConstraintException
* @throws \Exception
*/
public function getSql(DoctrineSqlFilter $sqlFilter, ClassMetadata $targetEntity, $targetTableAlias)
{
$targetEntityPropertyName = strpos($this->path, '.') ? substr($this->path, 0, strpos($this->path, '.')) : $this->path;
$quoteStrategy = $this->entityManager->getConfiguration()->getQuoteStrategy();
if ($targetEntity->hasAssociation($targetEntityPropertyName) === FALSE) {
return $this->getSqlForSimpleProperty($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
} elseif (strstr($this->path, '.') === FALSE && $targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === FALSE) {
return $this->getSqlForManyToOneAndOneToOneRelationsWithoutPropertyPath($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
} elseif ($targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === FALSE) {
return $this->getSqlForManyToOneAndOneToOneRelationsWithPropertyPath($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
} elseif ($targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === TRUE) {
throw new InvalidQueryRewritingConstraintException('Single valued properties from the inverse side are not supported in a content security constraint path! Got: "' . $this->path . ' ' . $this->operator . ' ' . $this->operandDefinition . '"', 1416397754);
} elseif ($targetEntity->isCollectionValuedAssociation($targetEntityPropertyName) === TRUE) {
throw new InvalidQueryRewritingConstraintException('Multivalued properties are not supported in a content security constraint path! Got: "' . $this->path . ' ' . $this->operator . ' ' . $this->operandDefinition . '"', 1416397655);
}
throw new InvalidQueryRewritingConstraintException('The configured operator of the entity constraint is not valid/supported. Got: ' . $this->operator, 1270483540);
}
示例7: driversFromManager
/**
* Create a driver from a Doctrine object manager.
*
* @param ObjectManager $om
*
* @return DriverInterface
*/
public static function driversFromManager(ObjectManager $om)
{
return self::driversFromMetadataDriver($om->getConfiguration()->getMetadataDriverImpl());
}