本文整理汇总了PHP中Doctrine\ORM\Event\LoadClassMetadataEventArgs::getObjectManager方法的典型用法代码示例。如果您正苦于以下问题:PHP LoadClassMetadataEventArgs::getObjectManager方法的具体用法?PHP LoadClassMetadataEventArgs::getObjectManager怎么用?PHP LoadClassMetadataEventArgs::getObjectManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Event\LoadClassMetadataEventArgs
的用法示例。
在下文中一共展示了LoadClassMetadataEventArgs::getObjectManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadClassMetadata
/**
* @param ORM\Event\LoadClassMetadataEventArgs $eventArgs
*
* @throws Exceptions\InvalidMappingException
*/
public function loadClassMetadata(ORM\Event\LoadClassMetadataEventArgs $eventArgs)
{
/** @var ORM\Mapping\ClassMetadata $classMetadata */
$classMetadata = $eventArgs->getClassMetadata();
$this->driver->loadMetadataForObjectClass($eventArgs->getObjectManager(), $classMetadata);
// Register pre persist event
$this->registerEvent($classMetadata, ORM\Events::prePersist);
// Register pre update event
$this->registerEvent($classMetadata, ORM\Events::preUpdate);
// Register pre remove event
$this->registerEvent($classMetadata, ORM\Events::preRemove);
}
示例2: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $event
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
$classMetadata = $event->getClassMetadata();
$className = $classMetadata->getName();
/** @var ExtendMetadataBuilder $metadataBuilder */
$metadataBuilder = $this->metadataBuilderServiceLink->getService();
if ($metadataBuilder->supports($className)) {
$classMetadataBuilder = new ClassMetadataBuilder($classMetadata);
$metadataBuilder->build($classMetadataBuilder, $className);
$event->getEntityManager()->getMetadataFactory()->setMetadataFor($className, $classMetadata);
}
$this->processDiscriminatorValues($classMetadata, $event->getObjectManager());
}
示例3: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $event
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
/** @var ClassMetadata $classMetadata */
$classMetadata = $event->getClassMetadata();
if (($resource = $this->resolveResource($classMetadata->getName())) !== null) {
foreach ($classMetadata->parentClasses as $parentClass) {
try {
$parentMetadata = $event->getObjectManager()->getClassMetadata($parentClass);
} catch (MappingException $e) {
continue;
}
/** @var ClassMetadata $parentMetadata */
if ($parentMetadata->inheritanceType === ClassMetadata::INHERITANCE_TYPE_NONE) {
$parentMetadata->isMappedSuperclass = true;
}
}
$classMetadata->setCustomRepositoryClass($resource->getRepository());
}
}