public function testSetConstructorOptionsSetsObjectOptionsIfAvailable()
 {
     $expected = array('hell' => 'yeah');
     $this->testObject = new Waf_Model_ConfiguratorTest_TestObjectWithOptions();
     Waf_Model_Configurator::setConstructorOptions($this->testObject, $expected);
     $this->assertEquals($expected, $this->testObject->options);
 }
Exemple #2
0
 public function setOptions(array $options)
 {
     if (!isset($options['identity'])) {
         $options['identity'] = array();
     }
     $this->setIdentity($options['identity']);
     unset($options['identity']);
     Waf_Model_Configurator::setOptions($this, $options);
 }
 /**
  * Constructor requires the property name as defined in the Entity.
  *
  * - If $options is an array, the property gets configured using
  *   Waf_Model_Configurator
  * - If $options is a string, it is treated as it would be the property name
  *   as defined in the Storage
  *
  * @param string $propertyName
  * @param array|string $options
  */
 public function __construct($options = array())
 {
     if (is_string($options)) {
         $options = array('propertyName' => $options);
     }
     if (!isset($options['propertyName'])) {
         throw new Waf_Model_Mapper_Exception('PropertyName is required for configuring a Property');
     }
     Waf_Model_Configurator::setOptions($this, $options);
 }
 public function __construct($options = null)
 {
     Waf_Model_Configurator::setConstructorOptions($this, $options);
 }