Doctrine 1.2.4
Doctrine_Search_Record Class Reference

Inherits Doctrine_Template.

Public Member Functions

 __get ($name)
 
 __isset ($name)
 
 __set ($name, $value)
 
 __unset ($name)
 
 actAs ($tpl, array $options=array())
 
 add ($value)
 
 addChild (Doctrine_Template $template)
 
 addListener ($listener, $name=null)
 
 attribute ($attr, $value)
 
 bind ($name, $resource)
 
 bindQueryParts (array $queryParts)
 
 check ($constraint, $name=null)
 
 contains ($offset)
 
 get ($name)
 
 getInvoker ()
 
 getListener ()
 
 getLocator ()
 
 getOption ($name, $default=null)
 
 getOptions ()
 
 getPlugin ()
 
 getTable ()
 
 hasColumn ($name, $type=null, $length=null, $options=array())
 
 hasColumns (array $definitions)
 
 hasMany ()
 
 hasOne ()
 
 hasPlugin ()
 
 index ($name, array $definition=array())
 
 locate ($name)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 option ($name, $value=null)
 
 remove ($offset)
 
 set ($name, $value)
 
 setArray (array $array)
 
 setColumnOption ($columnName, $option, $value)
 
 setColumnOptions ($name, array $options)
 
 setInvoker (Doctrine_Record_Abstract $invoker)
 
 setListener ($listener)
 
 setLocator (Doctrine_Locator $locator)
 
 unique ($fields, $options=array(), $createUniqueIndex=true)
 

Static Public Member Functions

static getNullObject ()
 
static initNullObject (Doctrine_Null $null)
 

Protected Attributes

 $_table
 

Detailed Description

Definition at line 33 of file Record.php.

Member Function Documentation

Doctrine_Access::__get (   $name)
inherited

Get key from data

See Also
get, offsetGet
Parameters
mixed$name
Returns
mixed

Definition at line 70 of file Access.php.

{
return $this->get($name);
}
Doctrine_Access::__isset (   $name)
inherited

Check if key exists in data

Parameters
string$name
Returns
boolean whether or not this object contains $name

Definition at line 81 of file Access.php.

{
return $this->contains($name);
}
Doctrine_Access::__set (   $name,
  $value 
)
inherited

Set key and value to data

See Also
set, offsetSet
Parameters
$name
$value
Returns
void

Definition at line 58 of file Access.php.

{
$this->set($name, $value);
}
Doctrine_Access::__unset (   $name)
inherited

Remove key from data

Parameters
string$name
Returns
void

Definition at line 92 of file Access.php.

{
return $this->remove($name);
}
Doctrine_Record_Abstract::actAs (   $tpl,
array  $options = array() 
)
inherited

Loads the given plugin.

This method loads a behavior in the record. It will add the behavior also to the record table if it. It is tipically called in

See Also
setUp().
Parameters
mixed$tplif an object, must be a subclass of Doctrine_Template. If a string, Doctrine will try to instantiate an object of the classes Doctrine_Template_$tpl and subsequently $tpl, using also autoloading capabilities if defined.
array$optionsargument to pass to the template constructor if $tpl is a class name
Exceptions
Doctrine_Record_Exceptionif $tpl is neither an instance of Doctrine_Template subclass or a valid class name, that could be instantiated.
Returns
Doctrine_Record this object; provides a fluent interface.

Definition at line 349 of file Abstract.php.

{
if ( ! is_object($tpl)) {
$className = 'Doctrine_Template_' . $tpl;
if (class_exists($className, true)) {
$tpl = new $className($options);
} else if (class_exists($tpl, true)) {
$tpl = new $tpl($options);
} else {
throw new Doctrine_Record_Exception('Could not load behavior named: "' . $tpl . '"');
}
}
if ( ! ($tpl instanceof Doctrine_Template)) {
throw new Doctrine_Record_Exception('Loaded behavior class is not an instance of Doctrine_Template.');
}
$className = get_class($tpl);
$this->_table->addTemplate($className, $tpl);
$tpl->setInvoker($this);
$tpl->setTable($this->_table);
$tpl->setUp();
$tpl->setTableDefinition();
return $this;
}
Doctrine_Access::add (   $value)
inherited

Add the value

Parameters
mixed$valueThe value to add
Returns
void

Definition at line 199 of file Access.php.

{
throw new Doctrine_Exception('Add is not supported for ' . get_class($this));
}
Doctrine_Template::addChild ( Doctrine_Template  $template)
inherited

Adds a plugin as a child to this plugin

Parameters
Doctrine_Template$template
Returns
Doctrine_Template. Chainable.

Definition at line 109 of file Template.php.

{
$this->_plugin->addChild($template);
return $this;
}
Doctrine_Record_Abstract::addListener (   $listener,
  $name = null 
)
inherited

addListener

Parameters
Doctrine_EventListener_Interface | Doctrine_Overloadable$listener
Returns
Doctrine_Record

Definition at line 67 of file Abstract.php.

{
$this->_table->addRecordListener($listener, $name);
return $this;
}
Doctrine_Record_Abstract::attribute (   $attr,
  $value 
)
inherited

attribute sets or retrieves an option

See Also
Doctrine_Core::ATTR_* constants availible attributes
Parameters
mixed$attr
mixed$value
Returns
mixed

Definition at line 182 of file Abstract.php.

{
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);
}
}
Doctrine_Locator_Injectable::bind (   $name,
  $resource 
)
inherited

bind binds a resource to a name

Parameters
string$namethe name of the resource to bind
mixed$valuethe value of the resource
Returns
Doctrine_Locator this object

Definition at line 120 of file Injectable.php.

{
$this->_resources[$name] = $resource;
return $this;
}
Doctrine_Record_Abstract::bindQueryParts ( array  $queryParts)
inherited

bindQueryParts binds query parts to given component

Parameters
array$queryPartsan array of pre-bound query parts
Returns
Doctrine_Record this object

Definition at line 322 of file Abstract.php.

{
$this->_table->bindQueryParts($queryParts);
return $this;
}
Doctrine_Record_Abstract::check (   $constraint,
  $name = null 
)
inherited

Adds a check constraint.

This method will add a CHECK constraint to the record table.

Parameters
mixed$constrainteither a SQL constraint portion or an array of CHECK constraints. If array, all values will be added as constraint
string$nameoptional constraint name. Not used if $constraint is an array.
Returns
Doctrine_Record this object

Definition at line 388 of file Abstract.php.

{
if (is_array($constraint)) {
foreach ($constraint as $name => $def) {
$this->_table->addCheckConstraint($def, $name);
}
} else {
$this->_table->addCheckConstraint($constraint, $name);
}
return $this;
}
Doctrine_Access::contains (   $offset)
inherited

Check if the specified offset exists

Parameters
mixed$offsetThe offset to check
Returns
boolean True if exists otherwise false

Definition at line 188 of file Access.php.

{
throw new Doctrine_Exception('Contains is not supported for ' . get_class($this));
}
Doctrine_Template::get (   $name)
inherited

get

Parameters
mixed$name
Returns
void

Definition at line 169 of file Template.php.

{
throw new Doctrine_Exception("Templates doesn't support accessors.");
}
Doctrine_Template::getInvoker ( )
inherited

returns the last used invoker

Returns
Doctrine_Record the record that invoked the last delegated call

Definition at line 98 of file Template.php.

{
return $this->_invoker;
}
Doctrine_Record_Abstract::getListener ( )
inherited

getListener

Returns
Doctrine_EventListener_Interface|Doctrine_Overloadable

Definition at line 79 of file Abstract.php.

{
return $this->_table->getRecordListener();
}
Doctrine_Locator_Injectable::getLocator ( )
inherited

getLocator returns the locator associated with this object

if there are no locator locally associated then this method tries to fetch the current global locator

Returns
Doctrine_Locator

Definition at line 75 of file Injectable.php.

{
if ( ! isset($this->_locator)) {
$this->_locator = Doctrine_Locator::instance();
}
return $this->_locator;
}
static Doctrine_Locator_Injectable::getNullObject ( )
staticinherited

getNullObject returns the null object associated with this object

Returns
Doctrine_Null

Definition at line 145 of file Injectable.php.

{
return self::$_null;
}
Doctrine_Template::getOption (   $name,
  $default = null 
)
inherited

getOption returns the value of given option

Parameters
string$namethe name of the option
mixed$defaultdefault value if option is not found
Returns
mixed the value of given option

Definition at line 155 of file Template.php.

{
if (isset($this->_options[$name])) {
return $this->_options[$name];
}
return $default;
}
Doctrine_Template::getOptions ( )
inherited

getOptions returns all options of this template and the associated values

Returns
array all options and their values

Definition at line 142 of file Template.php.

{
return $this->_options;
}
Doctrine_Template::getPlugin ( )
inherited

Get plugin instance

Returns
void

Definition at line 121 of file Template.php.

{
return $this->_plugin;
}
Doctrine_Template::getTable ( )
inherited

returns the associated table object

Returns
Doctrine_Table the associated table object

Definition at line 77 of file Template.php.

{
return $this->_table;
}
Doctrine_Record_Abstract::hasColumn (   $name,
  $type = null,
  $length = null,
  $options = array() 
)
inherited

Sets a column definition

Parameters
string$name
string$type
integer$length
mixed$options
Returns
void

Definition at line 260 of file Abstract.php.

{
$this->_table->setColumn($name, $type, $length, $options);
}
Doctrine_Record_Abstract::hasColumns ( array  $definitions)
inherited

Set multiple column definitions at once

Parameters
array$definitions
Returns
void

Definition at line 271 of file Abstract.php.

{
foreach ($definitions as $name => $options) {
$length = isset($options['length']) ? $options['length']:null;
$this->hasColumn($name, $options['type'], $length, $options);
}
}
Doctrine_Record_Abstract::hasMany ( )
inherited

Binds One-to-Many / Many-to-Many aggregate relation

Parameters
string$componentNamethe name of the related component
string$optionsrelation options
See Also
Doctrine_Relation::_$definition
Returns
Doctrine_Record this object

Definition at line 244 of file Abstract.php.

{
$this->_table->bind(func_get_args(), Doctrine_Relation::MANY);
return $this;
}
Doctrine_Record_Abstract::hasOne ( )
inherited

Binds One-to-One aggregate relation

Parameters
string$componentNamethe name of the related component
string$optionsrelation options
See Also
Doctrine_Relation::_$definition
Returns
Doctrine_Record this object

Definition at line 229 of file Abstract.php.

{
$this->_table->bind(func_get_args(), Doctrine_Relation::ONE);
return $this;
}
Doctrine_Template::hasPlugin ( )
inherited

Check if this template has a generator plugin

Returns
boolean

Definition at line 131 of file Template.php.

{
return isset($this->_plugin) ? true : false;
}
Doctrine_Record_Abstract::index (   $name,
array  $definition = array() 
)
inherited

index defines or retrieves an index if the second parameter is set this method defines an index if not this method retrieves index named $name

Parameters
string$namethe name of the index
array$definitionthe definition array
Returns
mixed

Definition at line 107 of file Abstract.php.

{
if ( ! $definition) {
return $this->_table->getIndex($name);
} else {
return $this->_table->addIndex($name, $definition);
}
}
static Doctrine_Locator_Injectable::initNullObject ( Doctrine_Null  $null)
staticinherited

initNullObject initializes the null object

Parameters
Doctrine_Null$null
Returns
void

Definition at line 134 of file Injectable.php.

{
self::$_null = $null;
}
Doctrine_Locator_Injectable::locate (   $name)
inherited

locate locates a resource by given name and returns it

if the resource cannot be found locally this method tries to use the global locator for finding the resource

See Also
Doctrine_Locator::locate()
Exceptions
Doctrine_Locator_Exceptionif the resource could not be found
Parameters
string$namethe name of the resource
Returns
mixed the located resource

Definition at line 96 of file Injectable.php.

{
if (isset($this->_resources[$name])) {
if (is_object($this->_resources[$name])) {
return $this->_resources[$name];
} else {
// get the name of the concrete implementation
$concreteImpl = $this->_resources[$name];
return $this->getLocator()->locate($concreteImpl);
}
} else {
return $this->getLocator()->locate($name);
}
}
Doctrine_Access::offsetExists (   $offset)
inherited

Check if an offset axists

Parameters
mixed$offset
Returns
boolean Whether or not this object contains $offset

Definition at line 103 of file Access.php.

{
return $this->contains($offset);
}
Doctrine_Access::offsetGet (   $offset)
inherited

An alias of get()

See Also
get, __get
Parameters
mixed$offset
Returns
mixed

Definition at line 115 of file Access.php.

{
return $this->get($offset);
}
Doctrine_Access::offsetSet (   $offset,
  $value 
)
inherited

Sets $offset to $value

See Also
set, __set
Parameters
mixed$offset
mixed$value
Returns
void

Definition at line 128 of file Access.php.

{
if ( ! isset($offset)) {
$this->add($value);
} else {
$this->set($offset, $value);
}
}
Doctrine_Access::offsetUnset (   $offset)
inherited

Unset a given offset

See Also
set, offsetSet, __set
Parameters
mixed$offset

Definition at line 143 of file Access.php.

{
return $this->remove($offset);
}
Doctrine_Record_Abstract::option (   $name,
  $value = null 
)
inherited

option sets or retrieves an option

See Also
Doctrine_Table::$options availible options
Parameters
mixed$namethe name of the option
mixed$valueoptions value
Returns
mixed

Definition at line 206 of file Abstract.php.

{
if ($value === null) {
if (is_array($name)) {
foreach ($name as $k => $v) {
$this->_table->setOption($k, $v);
}
} else {
return $this->_table->getOption($name);
}
} else {
$this->_table->setOption($name, $value);
}
}
Doctrine_Access::remove (   $offset)
inherited

Remove the element with the specified offset

Parameters
mixed$offsetThe offset to remove
Returns
boolean True if removed otherwise false

Definition at line 154 of file Access.php.

{
throw new Doctrine_Exception('Remove is not supported for ' . get_class($this));
}
Doctrine_Template::set (   $name,
  $value 
)
inherited

set

Parameters
mixed$name
mixed$value
Returns
void

Definition at line 181 of file Template.php.

{
throw new Doctrine_Exception("Templates doesn't support accessors.");
}
Doctrine_Access::setArray ( array  $array)
inherited

Set an entire aray to the data

Parameters
array$arrayAn array of key => value pairs
Returns
Doctrine_Access

Definition at line 41 of file Access.php.

{
foreach ($array as $k => $v) {
$this->set($k, $v);
}
return $this;
}
Doctrine_Record_Abstract::setColumnOption (   $columnName,
  $option,
  $value 
)
inherited

Set an individual column option

Parameters
string$columnName
string$option
string$value
Returns
void

Definition at line 310 of file Abstract.php.

{
$this->_table->setColumnOption($columnName, $option, $value);
}
Doctrine_Record_Abstract::setColumnOptions (   $name,
array  $options 
)
inherited

Customize the array of options for a column or multiple columns. First argument can be a single field/column name or an array of them. The second argument is an array of options.

[php]
public function setTableDefinition()
{
    parent::setTableDefinition();
    $this->setColumnOptions('username', array(
        'unique' => true
    ));
}
Parameters
string$columnName
array$validators
Returns
void

Definition at line 297 of file Abstract.php.

{
$this->_table->setColumnOptions($name, $options);
}
Doctrine_Template::setInvoker ( Doctrine_Record_Abstract  $invoker)
inherited

sets the last used invoker

Parameters
Doctrine_Record$invokerthe record that invoked the last delegated call
Returns
Doctrine_Template this object

Definition at line 88 of file Template.php.

{
$this->_invoker = $invoker;
}
Doctrine_Record_Abstract::setListener (   $listener)
inherited

setListener

Parameters
Doctrine_EventListener_Interface | Doctrine_Overloadable$listener
Returns
Doctrine_Record

Definition at line 90 of file Abstract.php.

{
$this->_table->setRecordListener($listener);
return $this;
}
Doctrine_Locator_Injectable::setLocator ( Doctrine_Locator  $locator)
inherited

setLocator this method can be used for setting the locator object locally

Parameters
Doctrine_Locatorthe locator object
Returns
Doctrine_Locator_Injectable this instance

Definition at line 60 of file Injectable.php.

{
$this->_locator = $locator;
return $this;
}
Doctrine_Record_Abstract::unique (   $fields,
  $options = array(),
  $createUniqueIndex = true 
)
inherited

Defines a n-uple of fields that must be unique for every record.

This method Will automatically add UNIQUE index definition and validate the values on save. The UNIQUE index is not created in the database until you use

See Also
export().
Parameters
array$fieldsvalues are fieldnames
array$optionsarray of options for unique validator
bool$createUniqueIndexWhether or not to create a unique index in the database
Returns
void

Definition at line 128 of file Abstract.php.

{
return $this->_table->unique($fields, $options, $createUniqueIndex);
}

Field Documentation

Doctrine_Record_Abstract::$_table
protectedinherited
Parameters
Doctrine_Table$_tablereference to associated Doctrine_Table instance

Definition at line 38 of file Abstract.php.


The documentation for this class was generated from the following file: