BRICKOO::AddSingletonDecorator (since version 2.0)
Syntax
boolean AddSingletonDecorator ( object $parentObject , string $decoratorName [, array $arguments = null [, string $decoratorType = " DECORATOR_EXTENDED " ]] )
Parameters
parentObject
The object to bind the decorator to.
decoratorName
The decorator (class) name to retrieve an singleton reference and bind to the object.
arguments
The arguments to pass to the decorator constructor method.
If the singleton already exists this arguments will be not used.
If the singleton already exists this arguments will be not used.
decoratorType
The decorator type to use for binding.
Description
Adds an singleton decorator to the object.
If the singleton object already exists as global singleton, the existing reference will be binded.
If the singleton object already exists as global singleton, the existing reference will be binded.
Return
boolean Returns true on success, false on fail.
See also
Examples
<?php
// bind decorator as type single and pass arguments to the constructor
BRICKOO::AddSingletonDecorator($object, 'myDecorator', array('name', 30), BRICKOO::DECORATOR_SINGLE);
?>
// bind decorator as type single and pass arguments to the constructor
BRICKOO::AddSingletonDecorator($object, 'myDecorator', array('name', 30), BRICKOO::DECORATOR_SINGLE);
?>
<?php
// bind decorator as type extended
BRICKOO::AddSingletonDecorator($object, 'myDecorator');
?>
// bind decorator as type extended
BRICKOO::AddSingletonDecorator($object, 'myDecorator');
?>
Last change 10/12/2009