getName() 공개 메소드

public getName ( ) : string
리턴 string
예제 #1
0
 public function testReadAccessorsReturnPropertiesValues()
 {
     $property = 'username';
     $value = new \stdClass();
     $definition = new Property($property, $value);
     $this->assertEquals($property, $definition->getName());
     $this->assertEquals($value, $definition->getValue());
 }
 /**
  * {@inheritdoc}
  *
  * @throws NoSuchPropertyException
  * @throws InaccessiblePropertyException
  * @throws InvalidArgumentException When the typehint does not match for example
  * @throws HydrationException
  */
 public function hydrate(ObjectInterface $object, Property $property, GenerationContext $context) : ObjectInterface
 {
     $instance = $object->getInstance();
     try {
         $this->propertyAccessor->setValue($instance, $property->getName(), $property->getValue());
     } catch (SymfonyNoSuchPropertyException $exception) {
         throw HydrationExceptionFactory::createForCouldNotHydrateObjectWithProperty($object, $property, 0, $exception);
     } catch (SymfonyAccessException $exception) {
         throw HydrationExceptionFactory::createForInaccessibleProperty($object, $property, 0, $exception);
     } catch (SymfonyInvalidArgumentException $exception) {
         throw HydrationExceptionFactory::createForInvalidProperty($object, $property, 0, $exception);
     } catch (SymfonyPropertyAccessException $exception) {
         throw HydrationExceptionFactory::create($object, $property, 0, $exception);
     }
     return new SimpleObject($object->getId(), $instance);
 }
예제 #3
0
 public static function createForCouldNotHydrateObjectWithProperty(ObjectInterface $object, Property $property, int $code = 0, \Throwable $previous = null) : NoSuchPropertyException
 {
     return new NoSuchPropertyException(sprintf('Could not hydrate the property "%s" of the object "%s" (class: %s).', $property->getName(), $object->getId(), get_class($object->getInstance())), $code, $previous);
 }