class Doctrine_Search_File extends Doctrine_Search (View source)

Doctrine_Search

Constants

INDEX_FILES

INDEX_TABLES

Properties

protected Doctrine_Locator $_locator from Doctrine_Locator_Injectable
protected array $_resources from Doctrine_Locator_Injectable
static protected Doctrine_Null $_null from Doctrine_Locator_Injectable
protected $_table from Doctrine_Record_Abstract
protected $_options from Doctrine_Search
protected bool $_initialized Whether or not the generator has been initialized from Doctrine_Record_Generator

Methods

setLocator(Doctrine_Locator $locator)

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

getLocator()

getLocator returns the locator associated with this object

mixed
locate(string $name)

locate locates a resource by given name and returns it

bind($name, $resource)

bind binds a resource to a name

static void
initNullObject(Doctrine_Null $null)

initNullObject initializes the null object

static Doctrine_Null
getNullObject()

getNullObject returns the null object associated with this object

setArray(array $array)

Set an entire aray to the data

void
__set($name, $value)

Set key and value to data

mixed
__get(string $option)

An alias for getOption

boolean
__isset(string $option)

__isset

void
__unset(string $name)

Remove key from data

boolean
offsetExists(mixed $offset)

Check if an offset axists

mixed
offsetGet(mixed $offset)

An alias of get()

void
offsetSet(mixed $offset, mixed $value)

Sets $offset to $value

offsetUnset(mixed $offset)

Unset a given offset

boolean
remove(mixed $offset)

Remove the element with the specified offset

mixed
get(mixed $offset)

Return the element with the specified offset

set(mixed $offset, mixed $value)

Set the offset to the value

boolean
contains(mixed $offset)

Check if the specified offset exists

void
add(mixed $value)

Add the value

setTableDefinition()

buildDefinition

setUp()

No description

getTable()

getTable returns the associated table object

addListener($listener, $name = null)

addListener

mixed
index(string $name, array $definition = array())

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

void
unique(array $fields, array $options = array(), bool $createUniqueIndex = true)

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

setAttribute($attr, $value)

No description

setTableName($tableName)

No description

setInheritanceMap($map)

No description

setSubclasses($map)

No description

mixed
attribute(mixed $attr, mixed $value)

attribute sets or retrieves an option

mixed
option(mixed $name, mixed $value = null)

option sets or retrieves an option

hasOne()

Binds One-to-One aggregate relation

hasMany()

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

void
hasColumn(string $name, string $type = null, integer $length = null, mixed $options = array())

Sets a column definition

void
hasColumns(array $definitions)

Set multiple column definitions at once

void
setColumnOptions($name, array $options)

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.

void
setColumnOption(string $columnName, string $option, string $value)

Set an individual column option

bindQueryParts(array $queryParts)

bindQueryParts binds query parts to given component

actAs(mixed $tpl, array $options = array())

Loads the given plugin.

check(mixed $constraint, string $name = null)

Adds a check constraint.

mixed
getOption($name)

Returns the value of an option

Doctrine_Plugin
setOption($name, $value)

Sets given value to an option

void
addChild(Doctrine_Record_Generator $generator)

Add child record generator

array
getOptions()

Returns all options and their associated values

void
initialize(Doctrine_Table $table)

Initialize the plugin. Call in Doctrine_Template setTableDefinition() in order to initiate a generator in a template

void
buildTable()

Create the new Doctrine_Table instance in $this->_table based on the owning table.

void
initOptions()

Empty template method for providing the concrete plugins the ability to initialize options before the actual definition is being built

void
buildChildDefinitions()

Build the child behavior definitions that are attached to this generator

array
buildForeignKeys(Doctrine_Table $table)

Generates foreign keys for the plugin table based on the owner table.

void
buildLocalRelation(string $alias = null)

Build the local relationship on the generated model for this generator instance which points to the invoking table in $this->_options['table']

void
ownerHasMany(string $name, array $options)

Add a Doctrine_Relation::MANY relationship to the generator owner table

void
ownerHasOne(string $name, array $options)

Add a Doctrine_Relation::ONE relationship to the generator owner table

void
buildForeignRelation(string $alias = null)

Build the foreign relationship on the invoking table in $this->_options['table'] which points back to the model generated in this generator instance.

string
getRelationLocalKey()

Get the local key of the generated relationship

string
getRelationForeignKey()

Get the foreign key of the generated relationship

void
buildRelation()

This method can be used for generating the relation from the plugin table to the owner table. By default buildForeignRelation() and buildLocalRelation() are called Those methods can be overridden or this entire method can be overridden

void
generateClassFromTable(Doctrine_Table $table)

Generate a Doctrine_Record from a populated Doctrine_Table instance

void
generateClass(array $definition = array())

Generates the class definition for plugin class

void
__construct(array $options = array())

constructor

array
search(string $string, Doctrine_Query $query = null)

Searchable keyword search

void
analyze(string $text, string $encoding = null)

analyze a text in the encoding format

integer
updateIndex(array $data, $encoding = null)

updateIndex updates the index

readTableData(mixed $limit = null, mixed $offset = null)

readTableData

void
batchUpdateIndex($limit = null, $offset = null, $encoding = null)

batchUpdateIndex

void
indexDirectory(string $dir)

indexes given directory

Details

Doctrine_Locator_Injectable setLocator(Doctrine_Locator $locator)

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

Parameters

Doctrine_Locator $locator the locator object

Return Value

Doctrine_Locator_Injectable this instance

Doctrine_Locator getLocator()

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

Return Value

Doctrine_Locator

mixed locate(string $name)

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

Parameters

string $name the name of the resource

Return Value

mixed the located resource

Exceptions

Doctrine_Locator_Exception if the resource could not be found

See also

Doctrine_Locator::locate

Doctrine_Locator bind($name, $resource)

bind binds a resource to a name

Parameters

$name
$resource

Return Value

Doctrine_Locator this object

static void initNullObject(Doctrine_Null $null)

initNullObject initializes the null object

Parameters

Doctrine_Null $null

Return Value

void

static Doctrine_Null getNullObject()

getNullObject returns the null object associated with this object

Return Value

Doctrine_Null

Doctrine_Access setArray(array $array)

Set an entire aray to the data

Parameters

array $array An array of key => value pairs

Return Value

Doctrine_Access

void __set($name, $value)

Set key and value to data

Parameters

$name
$value

Return Value

void

See also

set, offsetSet

mixed __get(string $option)

An alias for getOption

Parameters

string $option

Return Value

mixed

boolean __isset(string $option)

__isset

Parameters

string $option

Return Value

boolean whether or not this object contains $name

void __unset(string $name)

Remove key from data

Parameters

string $name

Return Value

void

boolean offsetExists(mixed $offset)

Check if an offset axists

Parameters

mixed $offset

Return Value

boolean Whether or not this object contains $offset

mixed offsetGet(mixed $offset)

An alias of get()

Parameters

mixed $offset

Return Value

mixed

See also

get, __get

void offsetSet(mixed $offset, mixed $value)

Sets $offset to $value

Parameters

mixed $offset
mixed $value

Return Value

void

See also

set, __set

offsetUnset(mixed $offset)

Unset a given offset

Parameters

mixed $offset

See also

set, offsetSet, __set

boolean remove(mixed $offset)

Remove the element with the specified offset

Parameters

mixed $offset The offset to remove

Return Value

boolean True if removed otherwise false

mixed get(mixed $offset)

Return the element with the specified offset

Parameters

mixed $offset The offset to return

Return Value

mixed

set(mixed $offset, mixed $value)

Set the offset to the value

Parameters

mixed $offset The offset to set
mixed $value The value to set the offset to

boolean contains(mixed $offset)

Check if the specified offset exists

Parameters

mixed $offset The offset to check

Return Value

boolean True if exists otherwise false

void add(mixed $value)

Add the value

Parameters

mixed $value The value to add

Return Value

void

setTableDefinition()

buildDefinition

Doctrine_Table getTable()

getTable returns the associated table object

Return Value

Doctrine_Table the associated table object

Doctrine_Record addListener($listener, $name = null)

addListener

Parameters

$listener
$name

Return Value

Doctrine_Record

mixed index(string $name, array $definition = array())

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 $name the name of the index
array $definition the definition array

Return Value

mixed

void unique(array $fields, array $options = array(), bool $createUniqueIndex = true)

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 export().

Parameters

array $fields values are fieldnames
array $options array of options for unique validator
bool $createUniqueIndex Whether or not to create a unique index in the database

Return Value

void

setAttribute($attr, $value)

Parameters

$attr
$value

setTableName($tableName)

Parameters

$tableName

setInheritanceMap($map)

Parameters

$map

setSubclasses($map)

Parameters

$map

mixed attribute(mixed $attr, mixed $value)

attribute sets or retrieves an option

Parameters

mixed $attr
mixed $value

Return Value

mixed

See also

Doctrine_Core::ATTR_* constants availible attributes

mixed option(mixed $name, mixed $value = null)

option sets or retrieves an option

Parameters

mixed $name the name of the option
mixed $value options value

Return Value

mixed

See also

Doctrine_Table::$options availible options

Doctrine_Record hasOne()

Binds One-to-One aggregate relation

Return Value

Doctrine_Record this object

See also

Doctrine_Relation::_$definition

Doctrine_Record hasMany()

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

Return Value

Doctrine_Record this object

See also

Doctrine_Relation::_$definition

void hasColumn(string $name, string $type = null, integer $length = null, mixed $options = array())

Sets a column definition

Parameters

string $name
string $type
integer $length
mixed $options

Return Value

void

void hasColumns(array $definitions)

Set multiple column definitions at once

Parameters

array $definitions

Return Value

void

void setColumnOptions($name, array $options)

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

$name
array $options

Return Value

void

void setColumnOption(string $columnName, string $option, string $value)

Set an individual column option

Parameters

string $columnName
string $option
string $value

Return Value

void

Doctrine_Record bindQueryParts(array $queryParts)

bindQueryParts binds query parts to given component

Parameters

array $queryParts an array of pre-bound query parts

Return Value

Doctrine_Record this object

loadGenerator(Doctrine_Record_Generator $generator)

Parameters

Doctrine_Record_Generator $generator

Doctrine_Record actAs(mixed $tpl, array $options = array())

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 setUp().

Parameters

mixed $tpl if 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 $options argument to pass to the template constructor if $tpl is a class name

Return Value

Doctrine_Record this object; provides a fluent interface.

Exceptions

Doctrine_Record_Exception if $tpl is neither an instance of Doctrine_Template subclass or a valid class name, that could be instantiated.

Doctrine_Record check(mixed $constraint, string $name = null)

Adds a check constraint.

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

Parameters

mixed $constraint either a SQL constraint portion or an array of CHECK constraints. If array, all values will be added as constraint
string $name optional constraint name. Not used if $constraint is an array.

Return Value

Doctrine_Record this object

mixed getOption($name)

Returns the value of an option

Parameters

$name

Return Value

mixed the value of the option

Doctrine_Plugin setOption($name, $value)

Sets given value to an option

Parameters

$name
$value

Return Value

Doctrine_Plugin this object

void addChild(Doctrine_Record_Generator $generator)

Add child record generator

Parameters

Doctrine_Record_Generator $generator

Return Value

void

array getOptions()

Returns all options and their associated values

Return Value

array all options as an associative array

void initialize(Doctrine_Table $table)

Initialize the plugin. Call in Doctrine_Template setTableDefinition() in order to initiate a generator in a template

Parameters

Doctrine_Table $table

Return Value

void

See also

Doctrine_Template_I18n

void buildTable()

Create the new Doctrine_Table instance in $this->_table based on the owning table.

Return Value

void

void initOptions()

Empty template method for providing the concrete plugins the ability to initialize options before the actual definition is being built

Return Value

void

void buildChildDefinitions()

Build the child behavior definitions that are attached to this generator

Return Value

void

array buildForeignKeys(Doctrine_Table $table)

Generates foreign keys for the plugin table based on the owner table.

These columns are automatically added to the generated model so we can create foreign keys back to the table object that owns the plugin.

Parameters

Doctrine_Table $table the table object that owns the plugin

Return Value

array an array of foreign key definitions

void buildLocalRelation(string $alias = null)

Build the local relationship on the generated model for this generator instance which points to the invoking table in $this->_options['table']

Parameters

string $alias Alias of the foreign relation

Return Value

void

void ownerHasMany(string $name, array $options)

Add a Doctrine_Relation::MANY relationship to the generator owner table

Parameters

string $name
array $options

Return Value

void

void ownerHasOne(string $name, array $options)

Add a Doctrine_Relation::ONE relationship to the generator owner table

Parameters

string $name
array $options

Return Value

void

void buildForeignRelation(string $alias = null)

Build the foreign relationship on the invoking table in $this->_options['table'] which points back to the model generated in this generator instance.

Parameters

string $alias Alias of the foreign relation

Return Value

void

string getRelationLocalKey()

Get the local key of the generated relationship

Return Value

string $local

string getRelationForeignKey()

Get the foreign key of the generated relationship

Return Value

string $foreign

void buildRelation()

This method can be used for generating the relation from the plugin table to the owner table. By default buildForeignRelation() and buildLocalRelation() are called Those methods can be overridden or this entire method can be overridden

Return Value

void

void generateClassFromTable(Doctrine_Table $table)

Generate a Doctrine_Record from a populated Doctrine_Table instance

Parameters

Doctrine_Table $table

Return Value

void

void generateClass(array $definition = array())

Generates the class definition for plugin class

Parameters

array $definition Definition array defining columns, relations and options for the model

Return Value

void

void __construct(array $options = array())

constructor

Parameters

array $options

Return Value

void

Searchable keyword search

Parameters

string $string Keyword string to search for
Doctrine_Query $query Query object to alter. Adds where condition to limit the results using the search index

Return Value

array ids and relevancy

void analyze(string $text, string $encoding = null)

analyze a text in the encoding format

Parameters

string $text
string $encoding

Return Value

void

integer updateIndex(array $data, $encoding = null)

updateIndex updates the index

Parameters

array $data
$encoding

Return Value

integer

Doctrine_Collection readTableData(mixed $limit = null, mixed $offset = null)

readTableData

Parameters

mixed $limit
mixed $offset

Return Value

Doctrine_Collection The collection of results

void batchUpdateIndex($limit = null, $offset = null, $encoding = null)

batchUpdateIndex

Parameters

$limit
$offset
$encoding

Return Value

void

void indexDirectory(string $dir)

indexes given directory

Parameters

string $dir the name of the directory to index

Return Value

void