当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassMetadata::getName方法代码示例

本文整理汇总了PHP中Doctrine\ODM\MongoDB\Mapping\ClassMetadata::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadata::getName方法的具体用法?PHP ClassMetadata::getName怎么用?PHP ClassMetadata::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ODM\MongoDB\Mapping\ClassMetadata的用法示例。


在下文中一共展示了ClassMetadata::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createResourceRepository

 /**
  * @param string                 $class
  * @param DocumentManager        $documentManager
  * @param ClassMetadata          $metadata
  * @param ResourceInterface|null $resource
  *
  * @return ObjectRepository
  */
 protected function createResourceRepository($class, DocumentManager $documentManager, ClassMetadata $metadata, ResourceInterface $resource = null)
 {
     if ($resource !== null && is_a($class, BaseRepositoryInterface::class, true)) {
         return new $class($documentManager, $documentManager->getUnitOfWork(), $metadata, $resource);
     }
     return parent::createRepository($documentManager, $metadata->getName());
 }
开发者ID:blazarecki,项目名称:lug,代码行数:15,代码来源:RepositoryFactory.php

示例2: __construct

 /**
  * Initializes a new BasicDocumentPersister instance.
  *
  * @param Doctrine\ODM\MongoDB\DocumentManager $dm
  * @param Doctrine\ODM\MongoDB\Mapping\ClassMetadata $class
  */
 public function __construct(DocumentManager $dm, ClassMetadata $class)
 {
     $this->_dm = $dm;
     $this->_uow = $dm->getUnitOfWork();
     $this->_class = $class;
     $this->_documentName = $class->getName();
     $this->_collection = $dm->getDocumentCollection($class->name);
 }
开发者ID:bzarzuela,项目名称:Doctrine-2-Blog-Example,代码行数:14,代码来源:BasicDocumentPersister.php

示例3: setCustomRepositoryClass

 /**
  * @param ClassMetadata $metadata
  */
 private function setCustomRepositoryClass(ClassMetadata $metadata)
 {
     try {
         $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName());
     } catch (\InvalidArgumentException $exception) {
         return;
     }
     if ($resourceMetadata->hasClass('repository')) {
         $metadata->setCustomRepositoryClass($resourceMetadata->getClass('repository'));
     }
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:14,代码来源:ODMRepositoryClassSubscriber.php

示例4: guardMissingShardKey

 /**
  * If the document is new, ignore shard key field value, otherwise throw an exception.
  * Also, shard key field should be present in actual document data.
  *
  * @param object $document
  * @param string $shardKeyField
  * @param array  $actualDocumentData
  *
  * @throws MongoDBException
  */
 private function guardMissingShardKey($document, $shardKeyField, $actualDocumentData)
 {
     $dcs = $this->uow->getDocumentChangeSet($document);
     $isUpdate = $this->uow->isScheduledForUpdate($document);
     $fieldMapping = $this->class->getFieldMappingByDbFieldName($shardKeyField);
     $fieldName = $fieldMapping['fieldName'];
     if ($isUpdate && isset($dcs[$fieldName]) && $dcs[$fieldName][0] != $dcs[$fieldName][1]) {
         throw MongoDBException::shardKeyFieldCannotBeChanged($shardKeyField, $this->class->getName());
     }
     if (!isset($actualDocumentData[$fieldName])) {
         throw MongoDBException::shardKeyFieldMissing($shardKeyField, $this->class->getName());
     }
 }
开发者ID:dominium,项目名称:mongodb-odm,代码行数:23,代码来源:DocumentPersister.php

示例5: let

 function let(RegistryInterface $registry, LoadClassMetadataEventArgs $event, ClassMetadata $classMetadata)
 {
     $classMetadata->getName()->willReturn('Foo');
     $event->getClassMetadata()->willReturn($classMetadata);
     $this->beConstructedWith($registry);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:6,代码来源:ODMRepositoryClassSubscriberSpec.php

示例6: __construct

 /**
  * Initializes a new BasicDocumentPersister instance.
  *
  * @param Doctrine\ODM\MongoDB\DocumentManager $dm
  * @param Doctrine\ODM\MongoDB\Mapping\ClassMetadata $class
  */
 public function __construct(DocumentManager $dm, ClassMetadata $class)
 {
     $this->dm = $dm;
     $this->uow = $dm->getUnitOfWork();
     $this->class = $class;
     $this->documentName = $class->getName();
     $this->collection = $dm->getDocumentCollection($class->name);
     $this->cmd = $this->dm->getConfiguration()->getMongoCmd();
 }
开发者ID:roydonstharayil,项目名称:sugarbox,代码行数:15,代码来源:BasicDocumentPersister.php

示例7: getName

 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     return $this->classMetadata->getName();
 }
开发者ID:ibasaw,项目名称:fixture-dumper,代码行数:7,代码来源:ClassMetadataProxy.php

示例8: generateTests

 public function generateTests(BundleInterface $bundle, ClassMetadata $class_metadata)
 {
     $document_name = explode('\\', $class_metadata->getName());
     $document_name = array_pop($document_name);
     // Controller Generator
     $dir = $bundle->getPath();
     $testControllerFile = $dir . '/Tests/Controller/' . $document_name . 'sControllerTest.php';
     if (file_exists($testControllerFile)) {
         throw new \RuntimeException(sprintf('Controller Test "%s" already exists', $document_name));
     }
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle->getName(), 'controller' => $document_name . 'sControllerTest');
     $this->renderFile('test/TestController.php.twig', $testControllerFile, $parameters);
 }
开发者ID:studiocaramia,项目名称:redking_CoreRestBundle,代码行数:13,代码来源:CrudGenerator.php


注:本文中的Doctrine\ODM\MongoDB\Mapping\ClassMetadata::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。