Source for file Abstract.php
Documentation is available at Abstract.php
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
* Doctrine_Record_Abstract
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @param Doctrine_Table $_table reference to associated Doctrine_Table instance
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable$listener
* @return Doctrine_Record
$this->_table->addRecordListener($listener, $name =
null);
* @return Doctrine_EventListener_Interface|Doctrine_Overloadable
return $this->_table->getRecordListener();
* @param Doctrine_EventListener_Interface|Doctrine_Overloadable$listener
* @return Doctrine_Record
$this->_table->setRecordListener($listener);
* defines or retrieves an index
* if the second parameter is set this method defines an index
* if not this method retrieves index named $name
* @param string $name the name of the index
* @param array $definition the definition array
public function index($name, array $definition =
array())
return $this->_table->getIndex($name);
return $this->_table->addIndex($name, $definition);
$this->_table->setAttribute($attr, $value);
$this->_table->setOption('tableName', $tableName);
$this->_table->setOption('inheritanceMap', $map);
$conn =
$this->_table->getConnection();
foreach ($map as $key =>
$value) {
$table =
$conn->getTable($key);
// $table->setOption('inheritanceMap', $value);
* sets or retrieves an option
* @see Doctrine::ATTR_* constants availible attributes
foreach ($attr as $k =>
$v) {
$this->_table->setAttribute($k, $v);
return $this->_table->getAttribute($attr);
$this->_table->setAttribute($attr, $value);
* sets or retrieves an option
* @see Doctrine_Table::$options availible options
* @param mixed $name the name of the option
* @param mixed $value options value
public function option($name, $value =
null)
foreach ($name as $k =>
$v) {
$this->_table->setOption($k, $v);
return $this->_table->getOption($name);
$this->_table->setOption($name, $value);
* binds One-to-One composite relation
* @param string $componentName the name of the related component
* @param string $options relation options
* @see Doctrine_Relation::_$definition
* @return Doctrine_Record this object
* binds One-to-Many / Many-to-Many composite relation
* @param string $componentName the name of the related component
* @param string $options relation options
* @see Doctrine_Relation::_$definition
* @return Doctrine_Record this object
* binds One-to-One aggregate relation
* @param string $componentName the name of the related component
* @param string $options relation options
* @see Doctrine_Relation::_$definition
* @return Doctrine_Record this object
* binds One-to-Many / Many-to-Many aggregate relation
* @param string $componentName the name of the related component
* @param string $options relation options
* @see Doctrine_Relation::_$definition
* @return Doctrine_Record this object
* sets a column definition
public function hasColumn($name, $type, $length =
2147483647, $options =
"")
$this->_table->setColumn($name, $type, $length, $options);
foreach ($definitions as $name =>
$options) {
$this->hasColumn($name, $options['type'], $options['length'], $options);
* @param string $template
public function loadTemplate($template, array $options =
array())
$tpl =
new $template($options);
$tpl->setTable($this->_table);
$tpl->setTableDefinition();
public function actAs($tpl, array $options =
array())
$tpl =
new $tpl($options);
$className =
'Doctrine_Template_' .
$tpl;
$tpl =
new $className($options);
$this->_table->addTemplate($className, $tpl);
$tpl->setTable($this->_table);
$tpl->setTableDefinition();
* adds a check constraint
* @param mixed $constraint either a SQL constraint portion or an array of CHECK constraints
* @param string $name optional constraint name
* @return Doctrine_Record this object
public function check($constraint, $name =
null)
foreach ($constraint as $name =>
$def) {
$this->_table->addCheckConstraint($def, $name);
$this->_table->addCheckConstraint($constraint, $name);