本文整理汇总了PHP中Doctrine\ORM\EntityRepository::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityRepository::__construct方法的具体用法?PHP EntityRepository::__construct怎么用?PHP EntityRepository::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\EntityRepository
的用法示例。
在下文中一共展示了EntityRepository::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* {@inheritdoc}
*/
public function __construct(EntityManager $em, ClassMetadata $class)
{
if ($class->getReflectionClass()->isSubclassOf('Gedmo\\Translatable\\Entity\\MappedSuperclass\\AbstractPersonalTranslation')) {
throw new \Gedmo\Exception\UnexpectedValueException('This repository is useless for personal translations');
}
parent::__construct($em, $class);
}
示例2: __construct
/**
* {@inheritdoc}
*/
public function __construct(EntityManager $em, ClassMetadata $class)
{
parent::__construct($em, $class);
if (isset($this->getClassMetadata()->associationMappings['translations']) && !empty($this->getClassMetadata()->associationMappings['translations'])) {
$this->_entityTranslationName = $this->getClassMetadata()->associationMappings['translations']['targetEntity'];
}
}
示例3: __construct
/**
* ActivityRepositoryAbstract constructor.
*
* @inheritdoc
*/
public function __construct($em, \Doctrine\ORM\Mapping\ClassMetadata $class)
{
$this->dayListResolver = new OptionsResolver();
$this->dayListResolver->setRequired(array('date_day', 'school'));
$this->configureDayListOptions($this->dayListResolver);
parent::__construct($em, $class);
}
示例4: __construct
/**
* Class constructor.
*
* @param type $em
* @param ClassMetadata $class
*/
public function __construct(EntityManager $em, ClassMetadata $class)
{
parent::__construct($em, $class);
$this->table = $this->getClassMetadata()->table['name'];
$this->name = $this->getClassMetadata()->fieldMappings['_name']['columnName'];
$this->value = $this->getClassMetadata()->fieldMappings['_value']['columnName'];
}
示例5: __construct
public function __construct(Application $app)
{
$this->app = $app;
$entityManager = $app[$this->entityManager];
$clazz = new ClassMetadata($this->modelName);
parent::__construct($entityManager, $clazz);
}
示例6: __construct
public function __construct($em, ClassMetadata $class)
{
parent::__construct($em, $class);
$this->className = $this->getClassName();
$this->entityName = $this->getEntityName();
$this->tableName = $class->getTableName();
}
示例7: __construct
public function __construct(\Doctrine\ORM\EntityManager $em, \Doctrine\ORM\Mapping\ClassMetadata $class)
{
$this->resolverGetEleves = new OptionsResolver();
$this->resolverGetEleves->setDefined(array('school_id', 'date_day', 'activity_type'));
$this->resolverGetEleves->setAllowedTypes('date_day', \DateTimeInterface::class);
$this->resolverGetEleves->setDefaults(array('school_id' => 0));
parent::__construct($em, $class);
}
示例8: __construct
public function __construct()
{
if (empty($this->entityName)) {
throw new LoSo_Exception('EntityName must be defined when extending LoSo GenericRepository.');
}
$em = Zend_Registry::get(LoSo_Zend_Application_Bootstrap_SymfonyContainerBootstrap::getRegistryIndex())->em;
$metadata = $em->getClassMetadata($this->entityName);
parent::__construct($em, $metadata);
}
示例9: array
function __construct($em, $class)
{
parent::__construct($em, $class);
$evm = $em->getEventManager();
//$evm->addEventListener(Events::prePersist, $this);
$this->className = $class->getReflectionClass()->getName();
$this->cachedMinOrder = array();
$this->cachedMaxOrder = array();
}
示例10: __construct
/**
* @param EntityManager $em
* @param Mapping\ClassMetadata $class
*/
public function __construct(EntityManager $em, Mapping\ClassMetadata $class)
{
$className = $class->getName();
if ($className != 'Supra\\Package\\Cms\\Entity\\Abstraction\\File') {
throw new LogicException("File repository should be called for file abstraction entity only, requested for '{$className}'");
}
parent::__construct($em, $class);
$this->nestedSetRepository = new DoctrineRepository($em, $class);
}
示例11: __construct
public function __construct(EntityManager $em, ClassMetadata $class, ContainerInterface $container)
{
parent::__construct($em, $class);
if ($container instanceof Container) {
$this->container = $container;
} else {
$this->container = new Container($container);
}
}
示例12: __construct
public function __construct($em, \Doctrine\ORM\Mapping\ClassMetadata $class)
{
parent::__construct($em, $class);
$conf = $this->getEntityManager()->getConfiguration();
$conf->addCustomNumericFunction('ACOS', 'DoctrineExtensions\\Query\\Mysql\\Acos');
$conf->addCustomNumericFunction('COS', 'DoctrineExtensions\\Query\\Mysql\\Cos');
//Comments the following line during the validation of the pull-request for PI() function
//$conf->addCustomNumericFunction('PI', 'DoctrineExtensions\Query\Mysql\Pi');
$conf->addCustomNumericFunction('SIN', 'DoctrineExtensions\\Query\\Mysql\\Sin');
}
示例13: __construct
/**
*
*/
public function __construct(EntityManager $entity_manager)
{
$metadata_factory = $entity_manager->getMetaDataFactory();
foreach ($metadata_factory->getAllMetaData() as $class => $metadata) {
if ($metadata->customRepositoryClassName == get_class($this)) {
$this->model = $metadata->getName();
}
}
parent::__construct($entity_manager, $entity_manager->getclassMetaData($this->model));
}
示例14: __construct
/**
* Initializes a new Repository.
*
* @param \Doctrine\Common\Persistence\ObjectManager $entityManager The EntityManager to use.
* @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata The class descriptor.
*/
public function __construct(\Doctrine\Common\Persistence\ObjectManager $entityManager, \Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata = NULL)
{
if ($classMetadata === NULL) {
if (static::ENTITY_CLASSNAME === NULL) {
$this->objectType = str_replace(array('\\Repository\\', 'Repository'), array('\\Model\\', ''), get_class($this));
} else {
$this->objectType = static::ENTITY_CLASSNAME;
}
$classMetadata = $entityManager->getClassMetadata($this->objectType);
}
parent::__construct($entityManager, $classMetadata);
$this->entityManager = $this->_em;
}
示例15: __construct
/**
* Initializes a new Repository.
*
* @param \Doctrine\Common\Persistence\ObjectManager $entityManager The EntityManager to use.
* @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata The class descriptor.
*/
public function __construct(\Doctrine\Common\Persistence\ObjectManager $entityManager, \Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata = null)
{
if ($classMetadata === null) {
if (defined('static::ENTITY_CLASSNAME') === false) {
$this->objectType = preg_replace(['/\\\\Repository\\\\/', '/Repository$/'], ['\\Model\\', ''], get_class($this));
} else {
$this->objectType = static::ENTITY_CLASSNAME;
}
$classMetadata = $entityManager->getClassMetadata($this->objectType);
}
parent::__construct($entityManager, $classMetadata);
$this->entityManager = $this->_em;
}