本文整理汇总了PHP中PHPCR\NodeInterface::getPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::getPropertyValue方法的具体用法?PHP NodeInterface::getPropertyValue怎么用?PHP NodeInterface::getPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCR\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::getPropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey = null)
{
if ($node->hasProperty($property->getName())) {
$value = $node->getPropertyValue($property->getName());
$property->setValue($value);
}
}
示例2: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$values = [];
if ($node->hasProperty($property->getName())) {
$values = $node->getPropertyValue($property->getName());
}
$this->setData($values, $property);
}
示例3: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$value = $this->defaultValue;
if ($node->hasProperty($property->getName())) {
$value = $node->getPropertyValue($property->getName());
}
$property->setValue($this->decodeValue($value));
return $value;
}
示例4: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$values = [];
if ($node->hasProperty($property->getName())) {
$values = $node->getPropertyValue($property->getName());
}
$refs = isset($values) ? $values : [];
$property->setValue($refs);
}
示例5: testReadPropertyNotExists
public function testReadPropertyNotExists()
{
$type = new ContactSelectionContentType($this->template, $this->contactManager->reveal(), $this->accountManager->reveal(), $this->serializer->reveal(), new CustomerIdConverter(), new IndexComparator());
$this->property->getName()->willReturn('test');
$this->node->hasProperty('test')->willReturn(false);
$this->node->getPropertyValue(Argument::any(), Argument::any())->shouldNotBeCalled();
$this->property->setValue([])->shouldBeCalled();
$type->read($this->node->reveal(), $this->property->reveal(), $this->webspaceKey, $this->locale, $this->segmentKey);
}
示例6: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$value = '';
if ($node->hasProperty($property->getName())) {
/** @var \DateTime $propertyValue */
$propertyValue = $node->getPropertyValue($property->getName());
$value = $propertyValue->format('Y-m-d');
}
$property->setValue($value);
return $value;
}
示例7: read
/**
* {@inheritdoc}
*/
public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
{
$value = $this->defaultValue;
if ($node->hasProperty($property->getName())) {
$value = $node->getPropertyValue($property->getName());
}
// the RedirectType subscriber sets the internal link as a reference
if ($value instanceof NodeInterface) {
$value = $value->getIdentifier();
}
$property->setValue($value);
return $value;
}
示例8: resolveMetadataForNode
/**
* {@inheritdoc}
*/
public function resolveMetadataForNode(NodeInterface $node)
{
if (false === $node->hasProperty('jcr:mixinTypes')) {
return;
}
$mixinTypes = (array) $node->getPropertyValue('jcr:mixinTypes');
foreach ($mixinTypes as $mixinType) {
if (true == $this->metadataFactory->hasMetadataForPhpcrType($mixinType)) {
return $this->metadataFactory->getMetadataForPhpcrType($mixinType);
}
}
return;
}
示例9: loadTranslation
/**
* {@inheritdoc}
*/
public function loadTranslation($document, NodeInterface $node, ClassMetadata $metadata, $locale)
{
if ($node->hasProperty($this->prefix . ':' . $locale . self::NULLFIELDS)) {
$nullFields = $node->getPropertyValue($this->prefix . ':' . $locale . self::NULLFIELDS);
$nullFields = array_flip($nullFields);
} else {
$nullFields = array();
}
foreach ($metadata->translatableFields as $field) {
$propName = $this->getTranslatedPropertyName($locale, $field);
if (isset($nullFields[$field])) {
$value = null;
} elseif ($node->hasProperty($propName)) {
$value = $node->getPropertyValue($propName);
} else {
// Could not find the translation in the given language
return false;
}
$metadata->reflFields[$field]->setValue($document, $value);
}
return true;
}
示例10: upgradeNode
/**
* Upgrade a single node.
*
* @param NodeInterface $node
* @param string $propertyName
* @param string $locale
*/
private function upgradeNode(NodeInterface $node, $propertyName, $locale)
{
foreach ($node->getNodes() as $child) {
$this->upgradeNode($child, $propertyName, $locale);
}
if (false === $node->getPropertyValueWithDefault($propertyName, false)) {
return;
}
$shadowLocale = $node->getPropertyValue($this->getPropertyName(self::SHADOW_BASE_PROPERTY, $locale));
$tags = $this->getTags($node, $shadowLocale);
$categories = $this->getCategories($node, $shadowLocale);
$navigationContext = $this->getNavigationContext($node, $shadowLocale);
$node->setProperty(sprintf(self::TAGS_PROPERTY, $locale), $tags);
$node->setProperty(sprintf(self::CATEGORIES_PROPERTY, $locale), $categories);
$node->setProperty(sprintf(self::NAVIGATION_CONTEXT_PROPERTY, $locale), $navigationContext);
}
示例11: updateResourceSegmentProperty
/**
* Updates the property for the resource segment on the given node.
*
* @param NodeInterface $node
* @param string $resourceSegmentPropertyName
* @param string $parentUuid
* @param string $webspaceKey
* @param string $locale
*/
private function updateResourceSegmentProperty(NodeInterface $node, $resourceSegmentPropertyName, $parentUuid, $webspaceKey, $locale)
{
$resourceLocatorStrategy = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey($webspaceKey);
$childPart = $resourceLocatorStrategy->getChildPart($node->getPropertyValue($resourceSegmentPropertyName));
$node->setProperty($resourceSegmentPropertyName, $resourceLocatorStrategy->generate($childPart, $parentUuid, $webspaceKey, $locale));
}
示例12: mapUrl
/**
* @param SessionInterface $session
* @param NodeInterface $node
*
* @return bool|string FALSE if not mapped, string if url is mapped
*/
protected function mapUrl(SessionInterface $session, NodeInterface $node)
{
$phpcrClass = $node->getPropertyValue('phpcr:class');
if (!is_subclass_of($phpcrClass, 'Symfony\\Cmf\\Component\\Routing\\RouteReferrersReadInterface')) {
return false;
}
try {
$url = $this->router->generate(null, array('content_id' => $node->getIdentifier()));
} catch (RouteNotFoundException $e) {
return false;
}
return $url;
}
示例13: checkNodeProperty
/**
* Check specified property exists, then compare property value to the supplied one using assertEquals.
*
* @param NodeInterface $node
* @param string $property
* @param mixed $value
*/
protected function checkNodeProperty(NodeInterface $node, $property, $value)
{
$this->assertTrue($node->hasProperty($property));
$this->assertEquals($value, $node->getPropertyValue($property));
}
示例14: upgradeProperty
/**
* Upgrades the given property to the new date representation.
*
* @param PropertyMetadata $property
* @param NodeInterface $node
* @param bool $up
*/
private function upgradeProperty(PropertyMetadata $property, NodeInterface $node, $locale, $up)
{
$name = sprintf('i18n:%s-%s', $locale, $property->getName());
if (!$node->hasProperty($name)) {
return;
}
$value = $node->getPropertyValue($name);
if ($up) {
$value = $this->upgradeDate($value);
} else {
$value = $this->downgradeDate($value);
}
$node->setProperty($name, $value);
}
示例15: upgradeNode
/**
* Upgrades the node to new date representation.
*
* @param NodeInterface $node The node to be upgraded
* @param string $locale The locale of the node to be upgraded
* @param array $properties The properties which are or contain date fields$up
*/
private function upgradeNode(NodeInterface $node, $locale, $properties, $up)
{
foreach ($properties as $property) {
$propertyName = $this->propertyEncoder->localizedContentName($property, $locale);
if ($node->hasProperty($propertyName)) {
$value = $this->upgradeProperty($node->getPropertyValue($propertyName), $up);
$node->setProperty($propertyName, $value);
}
}
}