. */ Doctrine::autoload('Doctrine_Access'); /** * Doctrine_Record_Abstract * * @package Doctrine * @subpackage Record * @author Konsta Vesterinen * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.phpdoctrine.org * @since 1.0 * @version $Revision$ */ abstract class Doctrine_Record_Abstract extends Doctrine_Access { /** * The metadata container that describes the entity class. * * @param Doctrine_ClassMetadata */ protected $_table; /** * * @var Doctrine_Mapper */ protected $_mapper; /** * @deprecated */ public function setTableDefinition() {} /** * @deprecated */ public function setUp() {} /** * getTable * returns the table object for this record * * @return Doctrine_Table a Doctrine_Table object * @deprecated */ public function getTable() { return $this->getClassMetadata(); } /** * Gets the ClassMetadata object that describes the entity class. */ public function getClassMetadata() { return $this->_table; } /** * Returns the mapper of the entity. * * @return Doctrine_Mapper */ public function getMapper() { return $this->_mapper; } /** * addListener * * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener * @return Doctrine_Record */ public function addListener($listener, $name = null) { $this->_table->addRecordListener($listener, $name = null); return $this; } /** * getListener * * @return Doctrine_EventListener_Interface|Doctrine_Overloadable */ public function getListener() { return $this->_table->getRecordListener(); } /** * setListener * * @param Doctrine_EventListener_Interface|Doctrine_Overloadable $listener * @return Doctrine_Record */ public function setListener($listener) { $this->_table->setRecordListener($listener); return $this; } public function setAttribute($attr, $value) { $this->_table->setAttribute($attr, $value); } /** * attribute * sets or retrieves an option * * @see Doctrine::ATTR_* constants availible attributes * @param mixed $attr * @param mixed $value * @return mixed */ public function attribute($attr, $value) { if ($value == null) { if (is_array($attr)) { foreach ($attr as $k => $v) { $this->_table->setAttribute($k, $v); } } else { return $this->_table->getAttribute($attr); } } else { $this->_table->setAttribute($attr, $value); } } }