/** * Instantiate the object * * If the behavior is auto mixed also lazy mix it into related row objects. * * @param ObjectConfig $config A ObjectConfig object with configuration options * @param ObjectManagerInterface $manager A ObjectInterface object * @return DatabaseBehaviorAbstract */ public static function getInstance(ObjectConfig $config, ObjectManagerInterface $manager) { $classname = $config->object_identifier->classname; $instance = new $classname($config); //If the behavior is auto mixed also lazy mix it into related row objects. if ($config->auto_mixin) { $identifier = clone $instance->getMixer()->getIdentifier(); $identifier->path = array('database', 'row'); $identifier->name = StringInflector::singularize($identifier->name); $manager->registerMixin($identifier, $instance); } return $instance; }
/** * Instantiate the object * * If the behavior is auto mixed also lazy mix it into related row objects. * * @param ObjectConfigInterface $config A ObjectConfig object with configuration options * @param ObjectManagerInterface $manager A ObjectInterface object * @return DatabaseBehaviorAbstract */ public static function getInstance(ObjectConfigInterface $config, ObjectManagerInterface $manager) { $class = $manager->getClass($config->object_identifier); $instance = new $class($config); //Lazy mix behavior into related row objects. A supported behavior always has one is[Behaviorable] method. if ($instance->isSupported() && $instance->getMixer() && count($instance->getMixableMethods()) > 1) { $identifier = $instance->getMixer()->getIdentifier()->toArray(); $identifier['path'] = array('database', 'row'); $identifier['name'] = StringInflector::singularize($identifier['name']); $manager->registerMixin($identifier, $instance); } return $instance; }