/** * {@inheritdoc} */ public function getProperty($name) { if ($this->hasProperty($name)) { $property = $this->structure->getProperty($name); } else { $property = $this->structure->getChild($name); } return $this->createLegacyPropertyFromItem($property); }
/** * {@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; }
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()); }