/**
  * (non-PHPdoc)
  * @see lib/form/data/collection/phSimpleDataCollection::createArrayDataItem()
  */
 protected function createArrayDataItem(phArrayKeyInfo $info, phFormViewElement $element, $name = null)
 {
     if ($name === null) {
         $name = $info->getKey();
     }
     if ($this->needsSimpleArrayType($info, $element)) {
         return new phSimpleArrayDataItem($name);
     } else {
         return new phArrayFormDataItem($name);
     }
 }
 public function registerArrayKey(phArrayKeyInfo $key, phData $dataItem)
 {
     /*
      * First check that the user has not tried to mix auto keys (e.g. data[]) with
      * specified ones (e.g. data[6] or data[name])
      */
     if ($this->_autoKey !== null && !$key->isAutoKey() || sizeof($this->_arrayTemplate) > 0 && $this->_autoKey === null && $key->isAutoKey()) {
         throw new phFormException("You cannot mix auto keys ([]) with specified keys: at {$this->_name}, level {$k}");
     } else {
         if ($key->isAutoKey() && $this->_autoKey === null) {
             $this->_autoKey = 0;
         }
     }
     $arrayKey = $key->getKey();
     if ($key->isAutoKey()) {
         $arrayKey = $this->_autoKey;
         $this->_autoKey++;
     }
     if (array_key_exists($arrayKey, $this->_arrayTemplate)) {
         throw new phFormException("the array with key {$key->getKey()} has already been registered");
     }
     $this->_arrayTemplate[$arrayKey] = $dataItem;
     return $dataItem;
 }
 /**
  * @return phArrayFormDataItem
  */
 protected function createArrayDataItem(phArrayKeyInfo $info, phFormViewElement $element, $name = null)
 {
     if ($name === null) {
         $name = $info->getKey();
     }
     return new phArrayFormDataItem($name);
 }
 /**
  * (non-PHPdoc)
  * @see lib/form/data/collection/phSimpleArrayDataCollection::needsSimpleArrayType()
  */
 public function needsSimpleArrayType(phArrayKeyInfo $info, phFormViewElement $element)
 {
     /*
      * if the select list is a multi select and the key is an auto key then
      * we'll need the simple array type
      */
     return $element instanceof phSelectListElement && $element->isMultiple() && $info->isAutoKey();
 }
 protected function needsSimpleArrayType(phArrayKeyInfo $info, phFormViewElement $element)
 {
     return $info->isAutoKey();
 }