本文整理汇总了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());
}
示例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);
}
示例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'));
}
}
示例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());
}
}
示例5: let
function let(RegistryInterface $registry, LoadClassMetadataEventArgs $event, ClassMetadata $classMetadata)
{
$classMetadata->getName()->willReturn('Foo');
$event->getClassMetadata()->willReturn($classMetadata);
$this->beConstructedWith($registry);
}
示例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();
}
示例7: getName
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->classMetadata->getName();
}
示例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);
}