/** * * @param boolean $pReload * @return Zupal_Nodes */ static function getInstance($pReload = FALSE) { if ($pReload || is_null(self::$_Instance)) { // process self::$_Instance = new Zupal_Nodes(Zupal_Domain_Abstract::STUB); } return self::$_Instance; }
/** * returns a single record matching the search crit. * If several records match the crit wil return the first one based on the sort param. * Note the variation that versioning inserts into the process * * @param scalar[] $searchCrit * @param string $sort * @return Zupal_Content_IDomain */ public function findOne($searchCrit = NULL, $sort = NULL, $pDomain = FALSE) { $table = $this->table(); $id_field = $table->idField(); $node_field = $this->node_field(); $select = $this->_select($searchCrit, $sort, $pDomain); if ($pDomain) { $row = $table->fetchRow($select); return $this->get($row); } else { if ($this->_is_versioned) { $node_stub = Zupal_Nodes::getInstance(); $cond = sprintf('( `%s`.%s = `%s`.node_id )', $table->tableName(), $this->node_field(), $node_stub->table()->tableName()); $cond .= sprintf(' AND (`%s`.%s = `%s`.version)', $table->tableName(), $id_field, $node_stub->table()->tableName()); //@TODO: cache this expression? $select->join($node_stub->table()->tableName(), $cond, array()); $row = $table->getAdapter()->fetchRow($select); $id = $row[$id_field]; // transfer data into domain objects. return is_null($id) ? NULL : $this->get($id); } else { $row = $this->table()->fetchRow($select); return $this->get($row); } } }
public function formmakervalidateAction() { $this->_helper->layout->disableLayout(); $this->view->table = $this->_getParam('table'); $this->view->detail = Zupal_Nodes::getInstance()->table()->getAdapter()->fetchAll('DESCRIBE ' . $this->view->table); }
/** * * @param boolean $pReload * @return Zupal_Nodes */ function node($pReload = FALSE) { if ($pReload || is_null($this->_node)) { $this->_node = new Zupal_Nodes($this->nodeId()); $this->_node->save(); } return $this->_node; }