/** * Constructor * * @param Conjoon_BeanContext_Decoratable $mixed The table class to model, or the classname * as a string of the model to decorate. The class will then try to * load the class and instantiate it with no arguments. * @param Conjoon_Filter_Input $filter An optional filter that gets processed before the * data is returned. The flter will only be used if teh data is decorated as dto or entity * @param boolean $strict if set to false, mising setters for any property available will not * throw an exception * * @throws Exception */ public final function __construct($mixed, Conjoon_Filter_Input $filter = null, $strict = true) { $this->_filter = $filter; $this->_strict = $strict; if (is_string($mixed)) { Conjoon_BeanContext_Inspector::loadClass($mixed); if (!class_exists($mixed)) { throw new Exception("Could not find class to decorate \"{$mixed}\"."); } $this->_decoratedModel = new $mixed(); } else { $this->_decoratedModel = $mixed; } if (!$this->_decoratedModel instanceof Conjoon_BeanContext_Decoratable) { throw new Exception("Decorated class is no subclass of \"Conjoon_BeanContext_Decoratable\""); } $this->_decoratedMethods = $this->_decoratedModel->getDecoratableMethods(); $this->_entity = $this->_decoratedModel->getRepresentedEntity(); Conjoon_BeanContext_Inspector::loadClass($this->_entity); if (!class_exists($this->_entity)) { throw new Exception("Could not find entity \"" . $this->_entity . "\"."); } $refC = new ReflectionClass($this->_entity); if (!$refC->implementsInterface('Conjoon_BeanContext')) { throw new Exception("Entity \"" . $this->_entity . "\" is not a \"Conjoon_BeanContext\"-class."); } }