public function initialize($subject, $callback=null)
    {
        $class = is_string($subject) ? ltrim($subject,'\\') : $subject::className();

        // initialize the object if needed
        if (!isset($this->_schema[$class])) {
            $builder = new \Pheasant\SchemaBuilder($this);
            $initializer = $callback ? $callback : $class.'::initialize';

            $this->events()->trigger('beforeInitialize', $builder);
            call_user_func($initializer, $builder, $this);
            $schema = $builder->build($class);

            $this->_schema[$class] = $schema;
            $this->events()->trigger('afterInitialize', $schema);
        }

        return $class;
    }
public function initialize($subject, $callback=null)
    {
        $class = is_string($subject) ? ltrim($subject,'\\') : $subject::className();

        // initialize the object if needed
        if (!isset($this->_schema[$class])) {
            $builder = new \Pheasant\SchemaBuilder($this);
            $initializer = $callback ? $callback : $class.'::initialize';

            $this->events()->trigger('beforeInitialize', $builder);
            call_user_func($initializer, $builder, $this);
            $schema = $builder->build($class);

            $this->_schema[$class] = $schema;
            $this->events()->trigger('afterInitialize', $schema);
        }

        return $class;
    }
public function initialize ( $ subject , $ callback = null ) { $ class = is_string ( $ subject ) ? ltrim ( $ subject , '\\' ) : $ subject :: className ( ) ; // initialize the object if needed if ( ! isset ( $ this -> _schema [ $ class ] ) ) { $ builder = new \ Pheasant \ SchemaBuilder ( $ this ) ; $ initializer = $ callback ? $ callback : $ class . '::initialize' ; $ this -> events ( ) -> trigger ( 'beforeInitialize' , $ builder ) ; call_user_func ( $ initializer , $ builder , $ this ) ; $ schema = $ builder -> build ( $ class ) ; $ this -> _schema [ $ class ] = $ schema ; $ this -> events ( ) -> trigger ( 'afterInitialize' , $ schema ) ; } return $ class ; }
Initializes a domain objects schema if it has not yet been initialized
@param $subject either an object or classname to initialize
@param $callback a callback to call instead of the initialize method
@return string the classname of the object
Initializes a domain objects schema if it has not yet been initialized