コード例 #1
0
ファイル: Collection.php プロジェクト: robertodormepoco/zf2
 /**
  * @return array
  */
 public function extract()
 {
     // In this specific situation, object holds the data, that is too say an array
     if (!is_array($this->object)) {
         return array();
     }
     $values = array();
     foreach ($this->object as $key => $value) {
         if ($value instanceof $this->targetElement->object) {
             $this->targetElement->object = $value;
             $values[$key] = $this->targetElement->extract();
         }
     }
     return $values;
 }
コード例 #2
0
ファイル: Collection.php プロジェクト: Baft/Zend-Form
 /**
  * @return array
  */
 public function extract()
 {
     if ($this->object instanceof Traversable) {
         $this->object = ArrayUtils::iteratorToArray($this->object);
     }
     if (!is_array($this->object)) {
         return array();
     }
     $values = array();
     foreach ($this->object as $key => $value) {
         if ($this->hydrator) {
             $values[$key] = $this->hydrator->extract($value);
         } elseif ($value instanceof $this->targetElement->object) {
             $this->targetElement->object = $value;
             $values[$key] = $this->targetElement->extract();
         }
     }
     return $values;
 }