/** * Test existence of row field * * @param string $columnName The column key. * @return boolean */ public function __isset($columnName) { $columnName = $this->_transformColumn($columnName); //Test direct column if ($this->columnsExists($columnName)) { return true; } //Test concatenation of column if (null !== ($pos = strpos($columnName, '+')) && $pos !== false) { $part1 = isset($this->{trim(substr($columnName, 0, $pos))}); $part2 = isset($this->{trim(substr($columnName, $pos + 1))}); return $part1 && $part2; } //Test reference, dependant and many dependant column with cascade if (null !== ($pos = strpos($columnName, '__')) && $pos !== false) { $row = $this->{substr($columnName, 0, $pos)}; if ($row == null) { return false; } return isset($row->{substr($columnName, $pos + 2)}); } //Test special get column if (array_key_exists($columnName, $this->_specialGets)) { if (!method_exists($this, $this->_specialGets[$columnName])) { throw new Centurion_Db_Table_Exception(sprintf("Specified method \"%s\" does not exist", $this->_specialGets[$columnName])); } return true; } $referenceMap = $this->getTable()->info('referenceMap'); if (isset($referenceMap[$columnName])) { return true; } $dependentTables = $this->getTable()->info('dependentTables'); if (isset($dependentTables[$columnName])) { return true; } $manyDependentTables = $this->getTable()->info('manyDependentTables'); if (isset($manyDependentTables[$columnName])) { return true; } return parent::__isset($columnName); }
/** * Test existence of row field * @param String $columnName The column key. * @return Boolean */ public function __isset($columnName) { // Check if native column from database. $result = parent::__isset($columnName); if (!$result) { // Check if "virtual" column added thru Garp modification. $result = array_key_exists($columnName, $this->_related) || array_key_exists($columnName, $this->_virtual); } return $result; }
/** * Overrides the magic isset method to support testing if a foreign key object * has been loaded for the requested attribute name. If the requested attribute * is not a foreign key object attribute, it simply invokes the parent class method. * @param string $name The attribute name to test. * @return bool */ public function __isset($name) { if ($this->hasForeignKey($name)) { return isset($this->_foreignObjects[$name]); } else { return parent::__isset($columnName); } }