__construct() public method

Initializes this instance with the specified document manager, unit of work and class metadata.
public __construct ( DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata )
$dm DocumentManager The DocumentManager to use.
$uow UnitOfWork The UnitOfWork to use.
$classMetadata Doctrine\ODM\MongoDB\Mapping\ClassMetadata The class metadata.
 /**
  * {@inheritdoc}
  */
 public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $class)
 {
     if ($class->getReflectionClass()->isSubclassOf('Gedmo\\Translatable\\Document\\MappedSuperclass\\AbstractPersonalTranslation')) {
         throw new \Gedmo\Exception\UnexpectedValueException('This repository is useless for personal translations');
     }
     parent::__construct($dm, $uow, $class);
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(DocumentManager $em, UnitOfWork $uow, ClassMetadata $class)
 {
     parent::__construct($em, $uow, $class);
     $treeListener = null;
     foreach ($em->getEventManager()->getListeners() as $listeners) {
         foreach ($listeners as $listener) {
             if ($listener instanceof \Gedmo\Tree\TreeListener) {
                 $treeListener = $listener;
                 break;
             }
         }
         if ($treeListener) {
             break;
         }
     }
     if (is_null($treeListener)) {
         throw new \Gedmo\Exception\InvalidMappingException('This repository can be attached only to ODM MongoDB tree listener');
     }
     $this->listener = $treeListener;
     if (!$this->validate()) {
         throw new \Gedmo\Exception\InvalidMappingException('This repository cannot be used for tree type: ' . $treeListener->getStrategy($em, $class->name)->getName());
     }
 }
示例#3
0
 /**
  * @param \Doctrine\ODM\MongoDB\DocumentManager $dm
  * @param \Doctrine\ODM\MongoDB\UnitOfWork $uow
  * @param \Doctrine\ODM\MongoDB\Mapping\ClassMetadata $classMetadata
  */
 public function __construct($dm, $uow, $classMetadata)
 {
     parent::__construct($dm, $uow, $classMetadata);
     $this->builder = new PhotoFactory();
 }
示例#4
0
 /**
  * @param DocumentManager   $dm
  * @param UnitOfWork        $uow
  * @param ClassMetadata     $class
  * @param ResourceInterface $resource
  */
 public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $class, ResourceInterface $resource)
 {
     parent::__construct($dm, $uow, $class);
     $this->resource = $resource;
 }
 public function __construct(ODM\DocumentManager $dm, ODM\UnitOfWork $uow, ODM\Mapping\ClassMetadata $class)
 {
     parent::__construct($dm, $uow, $class);
     $eventArgs = new DoctrineMongoODM\Event\EventArgs(array('repository' => $this));
     $dm->getEventManager()->dispatchEvent(DoctrineMongoODM\Event\RepositoryEventsSubscriber::postConstruct, $eventArgs);
 }
 /**
  * Repository constructor overridden to reuse field maps
  * Initializes a new <tt>DocumentRepository</tt>.
  *
  * @param DocumentManager $dm            The DocumentManager to use.
  * @param UnitOfWork      $uow           The UnitOfWork to use.
  * @param ClassMetadata   $classMetadata The class descriptor.
  */
 public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata)
 {
     parent::__construct($dm, $uow, $classMetadata);
     $this->orderByFields = array_merge($this->orderByFields, $this->orderByRelationFields);
     $this->filterByFields = $this->orderByFields;
 }