data['extends']) ) { if ( !$parentData = $provider->getChildrenData('Model', $this->data['extends']) ) throw new Exception(sprintf( 'Parent Model "%3$s" for Child Model "%2$s" in Provider "%1$s" does not exists !', $provider->getName(), $this->data['name'], $this->data['extends'] )); // extends services $this->data['children']['Service'] = array_merge( !empty($parentData['children']['Service']) ? $parentData['children']['Service'] : array(), !empty($this->data['children']['Service']) ? $this->data['children']['Service'] : array() ); // extends views $this->data['children']['View'] = array_merge( !empty($parentData['children']['View']) ? $parentData['children']['View'] : array(), !empty($this->data['children']['View']) ? $this->data['children']['View'] : array() ); } } public function getIterator () { return $this->__get('Field'); } public function apply () { $errors = array(); foreach ( $this->model->Field as $name => $field ) if ( $field->apply($this->data) ) return $this; } public function invalid () { $errors = array(); foreach ( $this->model->Field as $name => $field ) if ( $error = $field->invalid( !empty($this->data[$field->getName()]) ? $this->data[$field->getName()] : null ) );// $errors[] = $error; return $errors; } public function getState ( $service, $data = array() ) { if ( $service ) return $this->getModel()->Service->$service->getState($data); throw new Exception(sprintf( 'Method "%1$s->%2$s" must be reimplemented in child class "%3$s" !', __CLASS__, __METHOD__, $this::getSubType() )); } public function getEntityObject ( $data = array() ) { return new EntityObject($this, $data); } } ?>