/**
  * @test
  */
 public function isPropertyGettableWorksOnStdClass()
 {
     $stdClassObject = new \stdClass();
     $stdClassObject->property = 'foo';
     $this->assertTrue(ObjectAccess::isPropertyGettable($stdClassObject, 'property'));
     $this->assertFalse(ObjectAccess::isPropertyGettable($stdClassObject, 'undefinedProperty'));
 }
 /**
  * Load the property value to be used for validation.
  *
  * In case the object is a doctrine proxy, we need to load the real instance first.
  *
  * @param object $object
  * @param string $propertyName
  * @return mixed
  */
 protected function getPropertyValue($object, $propertyName)
 {
     if ($object instanceof \Doctrine\ORM\Proxy\Proxy) {
         $object->__load();
     }
     if (ObjectAccess::isPropertyGettable($object, $propertyName)) {
         return ObjectAccess::getProperty($object, $propertyName);
     } else {
         return ObjectAccess::getProperty($object, $propertyName, true);
     }
 }
 /**
  * Returns the specified property.
  *
  * If the node has a content object attached, the property will be fetched
  * there if it is gettable.
  *
  * @param string $propertyName Name of the property
  * @return mixed value of the property
  * @throws NodeException if the content object exists but does not contain the specified property.
  */
 public function getProperty($propertyName)
 {
     if (!is_object($this->contentObjectProxy)) {
         $value = isset($this->properties[$propertyName]) ? $this->properties[$propertyName] : null;
         if (!empty($value)) {
             if ($this->getNodeType()->getPropertyType($propertyName) === 'references') {
                 if (!is_array($value)) {
                     $value = array();
                 }
             }
         }
         return $value;
     } elseif (ObjectAccess::isPropertyGettable($this->contentObjectProxy->getObject(), $propertyName)) {
         return ObjectAccess::getProperty($this->contentObjectProxy->getObject(), $propertyName);
     }
     throw new NodeException(sprintf('Property "%s" does not exist in content object of type %s.', $propertyName, get_class($this->contentObjectProxy->getObject())), 1291286995);
 }