Esempio n. 1
0
 public function init(array $data)
 {
     if (!empty($data)) {
         if (!empty($data['path'])) {
             $data = array_merge($data, $data['path']);
             unset($data['path']);
         }
         parent::init($data);
         foreach ($data as $key => $value) {
             if ($key === 'collection') {
                 $this->setCollection($value);
             } elseif ($key === 'key') {
                 $this->setKey($value);
             } elseif ($key === 'type') {
                 $this->setType($value);
             } elseif ($key === 'timestamp') {
                 $this->setTimestamp($value);
             } elseif ($key === 'ordinal') {
                 $this->setOrdinal($value);
             } elseif ($key === 'ordinal_str') {
                 $this->setOrdinalStr($value);
             }
         }
     }
     return $this;
 }
 public function init(array $data)
 {
     if (!empty($data)) {
         if (!empty($data['path'])) {
             $data = array_merge($data, $data['path']);
             unset($data['path']);
         }
         parent::init($data);
         foreach ($data as $key => $value) {
             if ($key === 'source') {
                 if (is_array($value)) {
                     $item = $this->getItemClass()->newInstance()->init($value);
                     $this->setSource($item);
                 } elseif ($value instanceof KeyValueInterface) {
                     $this->setSource($value);
                 }
             } elseif ($key === 'destination') {
                 if (is_array($value)) {
                     $item = $this->getItemClass()->newInstance()->init($value);
                     $this->setDestination($item);
                 } elseif ($value instanceof KeyValueInterface) {
                     $this->setDestination($value);
                 }
             } elseif ($key === 'relation') {
                 $this->setRelation($value);
             }
         }
     }
     return $this;
 }
Esempio n. 3
0
 public function init(array $data)
 {
     if (!empty($data)) {
         if (!empty($data['path'])) {
             $data = array_merge($data, $data['path']);
             unset($data['path']);
         }
         parent::init($data);
         foreach ($data as $key => $value) {
             if ($key === 'collection') {
                 $this->setCollection($value);
             } elseif ($key === 'key') {
                 $this->setKey($value);
             } elseif ($key === 'tombstone') {
                 $this->_tombstone = (bool) $value;
             }
         }
     }
     return $this;
 }