getProperty() 공개 메소드

Return a model property.
또한 보기: StructureMetadata::getProperties()
public getProperty ( string $name ) : PropertyMetadata
$name string
리턴 PropertyMetadata
예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getProperty($name)
 {
     if ($this->hasProperty($name)) {
         $property = $this->structure->getProperty($name);
     } else {
         $property = $this->structure->getChild($name);
     }
     return $this->createLegacyPropertyFromItem($property);
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function getContentViewProperty($name)
 {
     if (isset($this->propertyValues[$name])) {
         return $this->propertyValues[$name];
     }
     // initialize the legacy property
     $this->getProperty($name);
     $legacyProperty = $this->legacyProperties[$name];
     $structureProperty = $this->structureMetadata->getProperty($name);
     $contentTypeName = $structureProperty->getType();
     $contentType = $this->contentTypeManager->get($contentTypeName);
     $propertyValue = new PropertyValue($name, $contentType->getContentData($legacyProperty));
     $this->propertyValues[$name] = $propertyValue;
     return $propertyValue;
 }
예제 #3
0
 private function doGetProperty($name, $contentTypeName, $locale)
 {
     $this->propertyMetadata->getType()->willReturn($contentTypeName);
     $this->structureMetadata->getProperty($name)->willReturn($this->propertyMetadata);
     $this->contentTypeManager->get($contentTypeName)->willReturn($this->contentType->reveal());
     if ($locale) {
         $this->propertyFactory->createTranslatedProperty($this->propertyMetadata->reveal(), $locale, Argument::type(StructureBridge::class))->willReturn($this->legacyProperty->reveal());
     } else {
         $this->propertyFactory->createProperty($this->propertyMetadata->reveal(), $locale)->willReturn($this->legacyProperty->reveal());
     }
     $this->contentType->read($this->node->reveal(), $this->legacyProperty->reveal(), null, null, null)->shouldBeCalledTimes(1);
     $property = $this->structure->getProperty($name);
     $this->assertInstanceOf(PropertyValue::class, $property);
     $this->assertEquals($name, $property->getName());
 }