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


PHP ObjectRepository::getClassName方法代码示例

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


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

示例1: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (!$value) {
         return null;
     }
     if (null === ($entity = $this->repository->findOneBy(array($this->identifier => $value)))) {
         throw new TransformationFailedException(sprintf('Object "%s" with identifier "%s"="%s" does not exist.', $this->repository->getClassName(), $this->identifier, $value));
     }
     return $entity;
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:13,代码来源:ObjectToIdentifierTransformer.php

示例2: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (null === $value) {
         return '';
     }
     $class = $this->repository->getClassName();
     if (!$value instanceof $class) {
         throw new UnexpectedTypeException($value, $class);
     }
     $accessor = PropertyAccess::createPropertyAccessor();
     return $accessor->getValue($value, $this->identifier);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:15,代码来源:ObjectToIdentifierTransformer.php

示例3: createUserIdentity

 public function createUserIdentity($user)
 {
     list($className, $identifier) = $this->extractUserIdentityFields($user);
     if (isset($this->userCache[$className][$identifier])) {
         return $this->userCache[$className][$identifier];
     }
     if (null !== ($this->userCache[$className][$identifier] = $this->userRepository->findOneBy(array('class' => $className, 'identifier' => $identifier)))) {
         return $this->userCache[$className][$identifier];
     }
     $userClass = $this->userRepository->getClassName();
     return $this->userCache[$className][$identifier] = new $userClass($className, $identifier);
 }
开发者ID:senthilkumar3282,项目名称:symfony-acl-bundle,代码行数:12,代码来源:SecurityIdentityFactory.php

示例4: createAce

 /**
  * Inserts a new ACE
  *
  * This method is idempotent.
  */
 public function createAce($grantee, $target, $permission, $flush = true)
 {
     $grantee = $this->extractSecurityIdentity($grantee);
     $target = $this->extractTargetIdentity($target);
     if (!isset($this->writeCache[$grantee])) {
         $this->writeCache[$grantee] = new \SplObjectStorage();
     }
     if (!isset($this->writeCache[$grantee][$target])) {
         // Permissions are strings, no need for an SplObjectStorage.
         $this->writeCache[$grantee][$target] = array();
     }
     $ace = null;
     if (isset($this->writeCache[$grantee][$target][$permission])) {
         $ace = $this->writeCache[$grantee][$target][$permission];
     } else {
         if (null !== $target->getId() && (null !== $grantee->getId() || SecurityIdentity::KIND_ANONYMOUS === $grantee->getKind())) {
             // Both the target is persisted and the grantee is either
             // persisted or anonymous. Let's see what the database has to
             // say regarding this ACE.
             $ace = $this->repository->findOneBy(array('grantee' => $this->generateCriteriaValue($grantee->getId()), 'target' => $this->generateCriteriaValue($target->getId()), 'permission' => $this->generateCriteriaValue($permission)));
         }
         if (null === $ace) {
             $aceClass = $this->repository->getClassName();
             $ace = $this->writeCache[$grantee][$target][$permission] = new $class($grantee, $target, $permission);
             $this->om->persist($ace);
         }
     }
     if ($flush) {
         $this->om->flush();
     }
     return $ace;
 }
开发者ID:senthilkumar3282,项目名称:symfony-acl-bundle,代码行数:37,代码来源:MutableProvider.php

示例5: getClassReflection

 /**
  * Get reflection of entity class
  * 
  * @return \ReflectionClass
  */
 protected function getClassReflection()
 {
     if ($this->reflection === null) {
         $class = $this->repository->getClassName();
         $this->reflection = new \ReflectionClass($class);
     }
     return $this->reflection;
 }
开发者ID:mikemirten,项目名称:zgrid-bundle,代码行数:13,代码来源:EntityAnnotationSchemaProvider.php

示例6: create

 /**
  * {@inheritdoc}
  */
 public function create(Utils\ArrayHash $values, Entities\IEntity $entity = NULL)
 {
     if (!$entity instanceof Entities\IEntity) {
         $entityName = $this->entityRepository->getClassName();
         $entity = $this->managerRegistry->getManagerForClass($entityName)->getClassMetadata($entityName)->newInstance();
     }
     if (!$entity || !$entity instanceof Entities\IEntity) {
         throw new Exceptions\InvalidArgumentException('Entity could not be created.');
     }
     $this->processHooks($this->beforeCreate, [$entity, $values]);
     $this->entityMapper->fillEntity($values, $entity, TRUE);
     $entityManager = $this->managerRegistry->getManagerForClass(get_class($entity));
     $entityManager->persist($entity);
     $this->processHooks($this->afterCreate, [$entity, $values]);
     if ($this->getFlush() === TRUE) {
         $entityManager->flush();
     }
     return $entity;
 }
开发者ID:iPublikuj,项目名称:doctrine,代码行数:22,代码来源:EntityCreator.php

示例7: createObjectFieldIdentity

 public function createObjectFieldIdentity($object, $fieldName)
 {
     list($className, $identifier) = $this->extractObjectIdentityFields($object);
     if (isset($this->objectFieldCache[$className][$identifier][$fieldName])) {
         return $this->objectFieldCache[$className][$identifier][$fieldName];
     }
     if (null !== $object->getId() && null !== ($this->objectFieldCache[$className][$identifier][$fieldName] = $this->objectFieldRepository->findOneBy(array('object' => $object->getId(), 'fieldName' => $fieldName)))) {
         return $this->objectFieldCache[$className][$identifier][$fieldName];
     }
     $objectFieldClass = $this->objectFieldRepository->getClassName();
     return $this->objectFieldCache[$className][$identifier][$fieldName] = new $objectFieldClass($object, $fieldName, $this->createClassFieldIdentity($object->getClassName(), $field));
 }
开发者ID:senthilkumar3282,项目名称:symfony-acl-bundle,代码行数:12,代码来源:TargetIdentityFactory.php

示例8:

 function it_should_create_entity(ManagerRegistry $registry, EntityManager $em, ClassFactory $factory, ObjectRepository $repository, ClassMetadataInfo $class)
 {
     $entity = (object) ['foo' => null, 'bar' => null];
     $class->getFieldNames()->willReturn(['id', 'foo', 'bar']);
     $class->setFieldValue($entity, 'id', null)->shouldBeCalled();
     $class->setFieldValue($entity, 'foo', 1)->shouldBeCalled();
     $class->setFieldValue($entity, 'bar', 2)->shouldBeCalled();
     $class->getAssociationNames()->willReturn([]);
     $repository->getClassName()->willReturn('foo');
     $factory->create('foo')->willReturn($entity);
     $em->getRepository('foo')->willReturn($repository);
     $em->getClassMetadata('foo')->willReturn($class);
     $em->persist($entity)->shouldBeCalled();
     $em->flush()->shouldBeCalled();
     $registry->getManager(null)->willReturn($em);
     $this->setRegistry($registry);
     $this->setClassFactory($factory);
     $entity->foo = 1;
     $entity->bar = 2;
     $this->create(['foo' => 1, 'bar' => 2])->shouldBe($entity);
 }
开发者ID:Im0rtality,项目名称:rest-api-bundle,代码行数:21,代码来源:DoctrineOrmSourceSpec.php

示例9: let

 function let(ObjectRepository $repository)
 {
     $repository->getClassName()->willReturn('spec\\Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\FakeEntity');
     $this->beConstructedWith($repository, 'id');
 }
开发者ID:Avazanga1,项目名称:Sylius,代码行数:5,代码来源:ObjectCollectionToIdentifiersTransformerSpec.php

示例10: __construct

 public function __construct(ObjectRepository $repository)
 {
     $this->repository = $repository;
     $this->class = $repository->getClassName();
 }
开发者ID:EdisonValdez,项目名称:IbrowsNewsletterBundle,代码行数:5,代码来源:MandantUserProvider.php

示例11: configureOptions

 /**
  * @param OptionsResolver $resolver
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     // We do not check if method exists because you may want to call a magic method
     $methodName = $this->methodName;
     $resolver->setDefaults(['choices' => call_user_func([$this->repository, $methodName]), 'class' => $this->repository->getClassName()]);
 }
开发者ID:juliendufresne,项目名称:JDFormBundle,代码行数:9,代码来源:EntityType.php

示例12: supportsClass

 /**
  * @param string $class
  *
  * @return bool
  */
 public function supportsClass($class)
 {
     return $this->userRepository->getClassName() === $class || is_subclass_of($class, $this->userRepository->getClassName());
 }
开发者ID:remy-theroux,项目名称:garbage-reducer-api,代码行数:9,代码来源:UserProvider.php

示例13: __construct

 public function __construct(ObjectRepository $repository)
 {
     $this->repository = $repository;
     parent::__construct($repository->getClassName());
 }
开发者ID:EdisonValdez,项目名称:IbrowsNewsletterBundle,代码行数:5,代码来源:NewsletterManager.php

示例14: __construct

 public function __construct(ObjectManager $em, ObjectRepository $repository)
 {
     $this->em = $em;
     $this->repository = $repository;
     $this->reflClass = new \ReflectionClass($repository->getClassName());
 }
开发者ID:20steps,项目名称:autotables-bundle,代码行数:6,代码来源:RepositoryAutoTablesCrudService.php


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