class Doctrine_Locator implements Countable, IteratorAggregate (View source)

Doctrine_Locator

Properties

protected array $_resources
protected string $_classPrefix
static protected array $_instances

Methods

void
__construct(array $defaults = null)

Constructor. Provide an array of resources to set initial contents.

static Sensei_Locator
instance()

instance

setClassPrefix(string $prefix)

setClassPrefix

string
getClassPrefix()

getClassPrefix

boolean
contains($name)

contains checks if a resource exists under the given name

Sensei_Locator
bind(string $name, mixed $value)

bind binds a resource to a name

mixed
locate(string $name)

locate locates a resource by given name and returns it

integer
count()

count returns the number of bound resources associated with this object

getIterator()

getIterator returns an ArrayIterator that iterates through all bound resources

Details

void __construct(array $defaults = null)

Constructor. Provide an array of resources to set initial contents.

Parameters

array $defaults

Return Value

void

static Sensei_Locator instance()

instance

Return Value

Sensei_Locator

setClassPrefix(string $prefix)

setClassPrefix

Parameters

string $prefix

string getClassPrefix()

getClassPrefix

Return Value

string

boolean contains($name)

contains checks if a resource exists under the given name

Parameters

$name

Return Value

boolean whether or not given resource name exists

Sensei_Locator bind(string $name, mixed $value)

bind binds a resource to a name

Parameters

string $name the name of the resource to bind
mixed $value the value of the resource

Return Value

Sensei_Locator this object

mixed locate(string $name)

locate locates a resource by given name and returns it

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

integer count()

count returns the number of bound resources associated with this object

Return Value

integer the number of resources

See also

Countable interface

ArrayIterator getIterator()

getIterator returns an ArrayIterator that iterates through all bound resources

Return Value

ArrayIterator an iterator for iterating through all bound resources