public function __construct(Mandango $mandango, $class, $field = null, Query $query = null, array $choices = array())
 {
     $this->mandango = $mandango;
     $this->class = $class;
     $this->field = $field;
     $this->query = $query;
     parent::__construct($choices);
 }
 public function __construct(ModelManagerInterface $modelManager, $class, $property = null, $query = null, $choices = array())
 {
     $this->modelManager = $modelManager;
     $this->class = $class;
     $this->query = $query;
     $this->identifier = $this->modelManager->getIdentifierFieldNames($this->class);
     // The property option defines, which property (path) is used for
     // displaying entities as strings
     if ($property) {
         $this->propertyPath = new PropertyPath($property);
     }
     parent::__construct($choices);
 }
 /**
  * @param string $class
  * @param string $property
  * @param array $choices
  * @param \ModelCriteria $queryObject
  */
 public function __construct($class, $property = null, $choices = array(), $queryObject = null)
 {
     $this->class = $class;
     $queryClass = $this->class . 'Query';
     $query = new $queryClass();
     $this->table = $query->getTableMap();
     $this->identifier = $this->table->getPrimaryKeys();
     $this->query = $queryObject ?: $query;
     // The property option defines, which property (path) is used for
     // displaying models as strings
     if ($property) {
         $this->propertyPath = new PropertyPath($property);
     }
     parent::__construct($choices);
 }
Exemple #4
0
    public function __construct(EntityManager $em, $class, $property = null, $queryBuilder = null, $choices = array())
    {
        // If a query builder was passed, it must be a closure or QueryBuilder
        // instance
        if (!(null === $queryBuilder || $queryBuilder instanceof QueryBuilder || $queryBuilder instanceof \Closure)) {
            throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder or \Closure');
        }

        if ($queryBuilder instanceof \Closure) {
            $queryBuilder = $queryBuilder($em->getRepository($class));

            if (!$queryBuilder instanceof QueryBuilder) {
                throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
            }
        }

        $this->em = $em;
        $this->class = $class;
        $this->queryBuilder = $queryBuilder;
        $this->unitOfWork = $em->getUnitOfWork();
        $this->identifier = $em->getClassMetadata($class)->getIdentifierFieldNames();

        // The property option defines, which property (path) is used for
        // displaying entities as strings
        if ($property) {
            $this->propertyPath = new PropertyPath($property);
        }

        parent::__construct($choices);
    }
 /**
  * Constructs
  *
  * @param array|\Closure $choices
  * @param boolean        $ajax
  */
 public function __construct($choices, $ajax = false)
 {
     $this->ajax = $ajax;
     parent::__construct($choices);
 }