public function clear($name) { parent::clear($name); $data = $this->get('data'); if (empty($data)) { $data = new \stdClass(); } unset($data->{$name}); $this->set('data', $data); }
public function toArray() { $data = parent::toArray(); $childList = $this->get('childList'); if (is_null($childList)) { $data['childList'] = null; } else { $arr = []; foreach ($childList as $entity) { $arr[] = $entity->toArray(); } $data['childList'] = $arr; } return $data; }