Пример #1
0
 /**
  * @param ModelManagerInterface $modelManager
  * @param string                $class
  * @param null                  $property
  * @param null                  $query
  * @param array                 $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($this->load($choices));
 }
Пример #2
0
 /**
  * @param ModelManagerInterface          $modelManager
  * @param string                         $class
  * @param null                           $property
  * @param null                           $query
  * @param array                          $choices
  * @param PropertyAccessorInterface|null $propertyAccessor
  */
 public function __construct(ModelManagerInterface $modelManager, $class, $property = null, $query = null, $choices = array(), PropertyAccessorInterface $propertyAccessor = null)
 {
     $this->modelManager = $modelManager;
     $this->class = $class;
     $this->property = $property;
     $this->query = $query;
     $this->choices = $choices;
     $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);
         $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
     }
 }