Exemplo n.º 1
0
 public function __construct($entitylist, $default = NULL, $nullable = TRUE, $validators = [], $filters = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($default, $validators, $filters, $context, $loops);
     if (is_string($entitylist)) {
         $entitylist = new FilteredEntityList($entitylist, NULL, [], 10, NULL, [], NULL, $this);
     }
     if (!$entitylist instanceof EntityList) {
         throw new Exception("Passed EntityList must be of type 'Loops\\Doctrine\\EntityList'");
     }
     $this->nullable = $nullable;
     $this->entitylist = $entitylist;
     $this->addInternalFilter(new DoctrineEntityFilter($entitylist, $loops));
 }
Exemplo n.º 2
0
 public function __construct(array $elements, $multiple = FALSE, $force_numeric_keys = FALSE, $default = NULL, $validators = [], $filters = [], $context = NULL, Loops $loops = NULL)
 {
     if (!$force_numeric_keys) {
         //make sure elements are all scalar, or array_combine will not be possible
         if (count(array_filter($elements, "is_scalar")) == count($elements)) {
             //check if the elements are consecutive numeric keys
             if (array_keys($elements) === array_keys(array_values($elements))) {
                 //if there is no duplicate set keys to values
                 if (count($elements) == count(array_unique($elements))) {
                     $elements = array_combine($elements, $elements);
                 }
             }
         }
     }
     if ($default === NULL) {
         $default = $multiple ? [] : "";
     }
     $this->elements = $elements;
     $this->multiple = $multiple;
     parent::__construct($default, $validators, $filters, $context, $loops);
     $this->addInternalFilter(new SelectFilter($elements, $this, $loops));
 }
Exemplo n.º 3
0
 public function __construct($default = "", $validators = [], $filters = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($default, $validators, $filters, $context, $loops);
     $this->addInternalFilter(new TextFilter($loops));
 }
Exemplo n.º 4
0
 public function offsetGet($offset)
 {
     return parent::offsetExists($offset) ? parent::offsetGet($offset) : $this->subform->offsetGet($offset);
 }