Exemplo n.º 1
0
 protected function _getAggregatedObject($property)
 {
     if (parent::has($property)) {
         $value = $this->_getRaw($property);
         if (is_object($value)) {
             return $value;
         }
     }
     $object = $this->_loadAggregatedObject($property);
     $this->_setRaw($property, $object);
     return $object;
 }
Exemplo n.º 2
0
 function has($var)
 {
     return $this->_hasGetMethodFor($var) || parent::has($var);
 }
Exemplo n.º 3
0
 function testImplementsArrayAccessInterface()
 {
     $o = new lmbObject();
     $o->set('foo', 'Bar');
     $this->assertEqual($o['foo'], 'Bar');
     $o['foo'] = 'Zoo';
     $this->assertEqual($o->get('foo'), 'Zoo');
     unset($o['foo']);
     $this->assertFalse($o->has('foo'));
     $o->set('foo', 'Bar');
     $this->assertTrue(isset($o['foo']));
     $this->assertFalse(isset($o['bar']));
 }
 protected function _checkDirtinessOfAggregatedObjectsFields()
 {
     foreach ($this->_composed_of as $property => $info) {
         if (!parent::has($property)) {
             continue;
         }
         $object = $this->_getRaw($property);
         if (!is_object($object)) {
             continue;
         }
         // for bc
         if (isset($info['getter'])) {
             $method = $info['getter'];
             $value = $object->{$method}();
             $this->_setARField($property, $value);
             continue;
         }
         if (!isset($info['mapping'])) {
             $mapping = array($property => $property);
         } else {
             $mapping = $info['mapping'];
         }
         foreach ($mapping as $aggregate_field => $ar_field) {
             if ($ar_field == $this->getPrimaryKeyName()) {
                 continue;
             }
             $this->_setARField($ar_field, $object->get($aggregate_field));
         }
     }
 }