php - Can't Initialize Class Gives Error 324 (net::ERR_EMPTY_RESPONSE) -
i want initialize class error 324 (net::err_empty_response)
this class want initialize:
<?php class cms_content_item_page extends cms_content_item_abstract { public $id; public $name; public $headline; public $image; public $description; public $content; }
and class extends from:
<?php abstract class cms_content_item_abstract { const no_setter = 'setter methode bestaat niet'; public $id; public $name; public $parent_id = 0; protected $_namespace = 'page'; protected $_pagemodel; public function __construct($pageid = null) { $this->_pagemodel = new cms_content_item_page(); if(null != $pageid) { $this->loadpageobject(intval($pageid)); } } protected function _getinnerrow($id = null) { if($id == null) { $id = $this->id; } return $this->_pagemodel->find($id)->current(); } protected function _getproperties() { $propertyarray = array(); $class = new zend_reflection_class($this); $properties = $class->getproperties(); foreach($properties $property) { if($property->ispublic()) { $propertyarray[] = $property->getname(); } } return $propertyarray; } protected function _callsettermethod($property,$data) { $method = zend_filter::filterstatic($property, 'word_underscoretocamelcase'); $methodname = '_set' . $method; if(method_exists($this,$methodname)) { return $this->$methodname($data); } else { return self::no_setter; } } public function loadpageobject($id) { $this->id = $id; $row = $this->getinnerrow(); if($row) { if($row->namespace != $this->_namespace) { throw new zend_exception('niet in staat om pagina type te weergeven:' . $row->namespace . ' naar type:' . $this->_namespace); } $this->name = $row->name; $this->parent_id = $row->parent_id; $contentnode = new model_contentnode(); $nodes = $row->finddependentrowset($contentnode); if($nodes) { $properties = $this->_getproperties(); foreach($nodes $node) { $key = $node['node']; if(in_array($key,$properties)) { $value = $this->_callsettermethod($key,$nodes); if($value === self::no_setter) { $value = $node['content']; } $this->$key = $value; } } } } else { throw new zend_exception("niet in staat om content item te laden"); } } public function toarray() { $properties = $this->_getproperties(); foreach($properties $property) { $array[$property] = $this->$property; } return $array; } public function save() { if(isset($this->id)) { $this->_update(); } else { $this->_insert(); } } protected function _insert() { $pageid = $this->_pagemodel->createpage( $this->name,$this->_namespace,$this->parent_id); $this->id = $pageid; $this->_update(); } protected function _update() { $data = $this->toarray(); $this->_pagemodel->updatepage($this->id,$data); } public function delete() { if(isset($this->id)) { $this->_pagemodel->deletepage($this->id); } else { throw new zend_exception('niet in staat om item te verwijderen; het item leeg!'); } } }
and in script i'm trying initialize class:
public function createaction() { $pageform = new form_pageform(); $pageform->setaction('/page/create') ->setmethod('post'); if($this->getrequest()->ispost()) { if($pageform->isvalid($_post)) { $itempage = new cms_content_item_page(); $itempage->name = $pageform->getvalue('name'); $itempage->headline = $pageform->getvalue('headline'); $itempage->description = $pageform->getvalue('description'); $itempage->content = $pageform->getvalue('content'); if($pageform->image->isuploaded()) { $pageform->image->receive(); $itempage->image = '/images/upload' . basename($pageform->image->getfilename()); } $itempage->save(); return $this->_forward('list'); } } $this->view->form = $pageform; }
in abstract class cms_content_item_abstract::__construct()
change $this->_pagemodel = new cms_content_item_page(); $this->_pagemodel = new model_page();
i encountered problem in book "zend cms project", bet caused author's mistyping.
Comments
Post a Comment