Upgrades the given property to the new date representation.

@param PropertyMetadata $property
@param NodeInterface $node
@param bool $up
171491
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);
    }
1288114
public function setProperty($propertyName, $value)
    {
        if (!is_object($this->contentObjectProxy)) {
            switch ($this->getNodeType()->getPropertyType($propertyName)) {
                case 'references':
                    $nodeIdentifiers = [];
                    if (is_array($value)) {
                        foreach ($value as $nodeIdentifier) {
                            if ($nodeIdentifier instanceof NodeInterface || $nodeIdentifier instanceof AbstractNodeData) {
                                $nodeIdentifiers[] = $nodeIdentifier->getIdentifier();
                            } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $nodeIdentifier) !== 0) {
                                $nodeIdentifiers[] = $nodeIdentifier;
                            }
                        }
                    }
                    $value = $nodeIdentifiers;
                    break;
                case 'reference':
                    $nodeIdentifier = null;
                    if ($value instanceof NodeInterface || $value instanceof AbstractNodeData) {
                        $nodeIdentifier = $value->getIdentifier();
                    } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $value) !== 0) {
                        $nodeIdentifier = $value;
                    }
                    $value = $nodeIdentifier;
                    break;
            }

            $this->persistRelatedEntities($value);

            if (array_key_exists($propertyName, $this->properties) && $this->properties[$propertyName] === $value) {
                return;
            }

            $this->properties[$propertyName] = $value;

            $this->addOrUpdate();
        } elseif (ObjectAccess::isPropertySettable($this->contentObjectProxy->getObject(), $propertyName)) {
            $contentObject = $this->contentObjectProxy->getObject();
            ObjectAccess::setProperty($contentObject, $propertyName, $value);
            $this->updateContentObject($contentObject);
        }
    }
836867
protected function importProperty(
        PropertyInterface $property,
        NodeInterface $node,
        StructureInterface $structure,
        $value,
        $webspaceKey,
        $locale,
        $format
    ) {
        $contentType = $property->getContentTypeName();

        if (!$this->importManager->hasImport($contentType, $format)) {
            return;
        }

        $translateProperty = $this->legacyPropertyFactory->createTranslatedProperty($property, $locale, $structure);
        $this->importManager->import($contentType, $node, $translateProperty, $value, null, $webspaceKey, $locale);
    }
1024296
private function handleUpgrade(array $node, NodePath $nodePath, string $newType)
    {
        if ((($node['nodeType'] == 'array') || ($newType == 'array')) && $this->autoUpgradeToArray) {
            $this->checkArrayUpgrade($node, $nodePath, $newType);
            // copy all properties to the array
            if (!empty($node[self::ARRAY_NAME])) {
                foreach ($node[self::ARRAY_NAME] as $key => $value) {
                    $newNode[self::ARRAY_NAME][$key] = $value;
                }
            }
            foreach ($node as $key => $value) {
                if (is_array($value) && ($key != self::ARRAY_NAME)) {
                    $newNode[self::ARRAY_NAME][$key] = $value;
                }
            }
            if ($newType != 'array') {
                $newNode[self::ARRAY_NAME]['nodeType'] = $newType;
            } else {
                $newNode[self::ARRAY_NAME]['nodeType'] = $node['nodeType'];
            }
            $newNode['nodeType'] = 'array';
            if (!empty($node['headerNames'])) {
                $newNode[self::ARRAY_NAME]['headerNames'] = self::DATA_COLUMN;
                $newNode['headerNames'] = $node['headerNames'];
            }
            $this->data = $this->storeNode($nodePath, $this->data, $newNode);
        } elseif (($node['nodeType'] != 'null') && ($newType == 'null')) {
            // do nothing, old type is fine
        } elseif (($node['nodeType'] == 'null') && ($newType != 'null')) {
            $newNode = $this->getNode($nodePath);
            $newNode['nodeType'] = $newType;
            $this->data = $this->storeNode($nodePath, $this->data, $newNode);
        } else {
            throw new JsonParserException(
                'Unhandled nodeType change from "' . $node['nodeType'] .
                '" to "' . $newType . '" in "' . $nodePath->__toString() . '"'
            );
        }
    }
523586
protected function addReverseProperty($property, NodeInterface $node)
    {
        $this->revProperties[$property][$node->getId()] = $node;
    }
802085
public function addProperty(Property $property)
    {
        $fieldName = $property->getName();

        // Check for empty field name
        if (empty($fieldName)) {
            throw MappingException::missingFieldName($this->className);
        }

        $property->setDeclaringClass($this);

        switch (true) {
            case $property instanceof VersionFieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                $this->validateAndCompleteVersionFieldMapping($property);
                break;

            case $property instanceof FieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                break;

            case $property instanceof OneToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteOneToOneMapping($property);
                break;

            case $property instanceof OneToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteOneToManyMapping($property);
                break;

            case $property instanceof ManyToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteManyToOneMapping($property);
                break;

            case $property instanceof ManyToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteManyToManyMapping($property);
                break;

            default:
                // Transient properties are ignored on purpose here! =)
                break;
        }

        $this->addDeclaredProperty($property);
    }
1082969
public function setFieldMeta($property, $value, $blnOverwrite = false)
    {
        return $this->__setMeta("field" . $property, $value, $blnOverwrite);
    }
1333404
private function upgradeProperty(PropertyValue $property, $addScheme)
    {
        $value = $property->getValue();
        if ($addScheme) {
            $this->upgradeUrl($value);
        } else {
            $this->downgradeUrl($value);
        }

        $property->setValue($value);
    }
100367
public function setMeta($property, $value, $blnOverwrite = false)
    {
        return $this->__setMeta($property, $value, $blnOverwrite);
    }
1349089
protected function removeReverseProperty($property, NodeInterface $node)
    {
        unset($this->revProperties[$property][$node->getId()]);

        if (0 === count($this->revProperties[$property])) {
            unset($this->revProperties[$property]);
        }
    }
1300671
protected function renderNodePropertyAttribute(NodeInterface $node, $propertyName)
    {
        $attributes = [];
        /** @var $contentContext ContentContext */
        $contentContext = $node->getContext();
        // skip the node name of the site node - TODO: Why do we need this?
        if ($propertyName === '_name' && $node === $contentContext->getCurrentSiteNode()) {
            return $attributes;
        }

        $dataType = $node->getNodeType()->getPropertyType($propertyName);
        $dasherizedPropertyName = $this->dasherize($propertyName);

        $propertyValue = $this->nodePropertyConverterService->getProperty($node, $propertyName);
        $propertyValue = $propertyValue === null ? '' : $propertyValue;
        $propertyValue = !is_string($propertyValue) ? json_encode($propertyValue) : $propertyValue;

        if ($dataType !== 'string') {
            $attributes['data-nodedatatype-' . $dasherizedPropertyName] = 'xsd:' . $dataType;
        }

        $attributes['data-node-' . $dasherizedPropertyName] = $propertyValue;

        return $attributes;
    }
343526
public function isUpdated($property = null)
    {
        if (null === $property) {
            return (count($this->updated) > 0);
        }

        return (isset($this->updated[$property]) && $this->updated[$property] === true);
    }
1121215
public function execute(NodeData $node)
    {
        foreach ($node->getNodeType()->getProperties() as $propertyName => $propertyConfiguration) {
            if (isset($propertyConfiguration['type']) && ($propertyConfiguration['type'] === ImageInterface::class || preg_match('/array\<.*\>/', $propertyConfiguration['type']))) {
                if (!isset($nodeProperties)) {
                    $nodeRecordQuery = $this->entityManager->getConnection()->prepare('SELECT properties FROM typo3_typo3cr_domain_model_nodedata WHERE persistence_object_identifier=?');
                    $nodeRecordQuery->execute([$this->persistenceManager->getIdentifierByObject($node)]);
                    $nodeRecord = $nodeRecordQuery->fetch(\PDO::FETCH_ASSOC);
                    $nodeProperties = unserialize($nodeRecord['properties']);
                }

                if (!isset($nodeProperties[$propertyName]) || empty($nodeProperties[$propertyName])) {
                    continue;
                }

                if ($propertyConfiguration['type'] === ImageInterface::class) {
                    $adjustments = [];
                    $oldVariantConfiguration = $nodeProperties[$propertyName];
                    if (is_array($oldVariantConfiguration)) {
                        foreach ($oldVariantConfiguration as $variantPropertyName => $property) {
                            switch (substr($variantPropertyName, 3)) {
                                case 'originalImage':
                                    /**
                                     * @var $originalAsset \Neos\Media\Domain\Model\Image
                                     */
                                    $originalAsset = $this->assetRepository->findByIdentifier($this->persistenceManager->getIdentifierByObject($property));
                                    break;
                                case 'processingInstructions':
                                    $adjustments = $this->processingInstructionsConverter->convertFrom($property, 'array');
                                    break;
                            }
                        }

                        $nodeProperties[$propertyName] = null;
                        if (isset($originalAsset)) {
                            $stream = $originalAsset->getResource()->getStream();
                            if ($stream === false) {
                                continue;
                            }

                            fclose($stream);
                            $newImageVariant = new ImageVariant($originalAsset);
                            foreach ($adjustments as $adjustment) {
                                $newImageVariant->addAdjustment($adjustment);
                            }
                            $originalAsset->addVariant($newImageVariant);
                            $this->assetRepository->update($originalAsset);
                            $nodeProperties[$propertyName] = $this->persistenceManager->getIdentifierByObject($newImageVariant);
                        }
                    }
                } elseif (preg_match('/array\<.*\>/', $propertyConfiguration['type'])) {
                    if (is_array($nodeProperties[$propertyName])) {
                        $convertedValue = [];
                        foreach ($nodeProperties[$propertyName] as $entryValue) {
                            if (!is_object($entryValue)) {
                                continue;
                            }

                            $stream = $entryValue->getResource()->getStream();
                            if ($stream === false) {
                                continue;
                            }

                            fclose($stream);
                            $existingObjectIdentifier = null;
                            try {
                                $existingObjectIdentifier = $this->persistenceManager->getIdentifierByObject($entryValue);
                                if ($existingObjectIdentifier !== null) {
                                    $convertedValue[] = $existingObjectIdentifier;
                                }
                            } catch (\Exception $exception) {
                            }
                        }
                        $nodeProperties[$propertyName] = $convertedValue;
                    }
                }
            }
        }

        if (isset($nodeProperties)) {
            $nodeUpdateQuery = $this->entityManager->getConnection()->prepare('UPDATE typo3_typo3cr_domain_model_nodedata SET properties=? WHERE persistence_object_identifier=?');
            $nodeUpdateQuery->execute([serialize($nodeProperties), $this->persistenceManager->getIdentifierByObject($node)]);
        }
    }
181545
private function cascadePreUpdate(ClassMetadata $class, object $document) : void
    {
        foreach ($class->getEmbeddedFieldsMappings() as $mapping) {
            $value = $class->reflFields[$mapping['fieldName']]->getValue($document);
            if ($value === null) {
                continue;
            }
            $values = $mapping['type'] === ClassMetadata::ONE ? [$value] : $value;

            foreach ($values as $entry) {
                if ($this->uow->isScheduledForInsert($entry) || empty($this->uow->getDocumentChangeSet($entry))) {
                    continue;
                }
                $this->preUpdate($this->dm->getClassMetadata(get_class($entry)), $entry);
            }
        }
    }
1237071
protected function validateAndCompleteVersionFieldMapping(VersionFieldMetadata $property)
    {
        $this->versionProperty = $property;

        $options = $property->getOptions();

        if (isset($options['default'])) {
            return;
        }

        if (in_array($property->getTypeName(), ['integer', 'bigint', 'smallint'], true)) {
            $property->setOptions(array_merge($options, ['default' => 1]));

            return;
        }

        if (in_array($property->getTypeName(), ['datetime', 'datetime_immutable', 'datetimetz', 'datetimetz_immutable'], true)) {
            $property->setOptions(array_merge($options, ['default' => 'CURRENT_TIMESTAMP']));

            return;
        }

        throw MappingException::unsupportedOptimisticLockingType($property->getType());
    }
343943
protected function addMetaTag(&$tags, $property = null, $content = null)
    {
        if (is_array($content)) {
            
            foreach ($content as $value) {
                $this->addMetaTag($tags, $property, $value);
            }
            
        } else {
            
            if ($content) {
                $tags .= $this->getMetaTag($property, $content);
            }
            
        }
    }
815456
private function doWrite(
        NodeInterface $node,
        PropertyInterface $property,
        $userId,
        $webspaceKey,
        $languageCode,
        $segmentKey,
        $isImport = false
    ) {
        if ($property->getIsBlock()) {
            /** @var BlockPropertyInterface $blockProperty */
            $blockProperty = $property;
            while (!($blockProperty instanceof BlockPropertyInterface)) {
                $blockProperty = $blockProperty->getProperty();
            }

            $data = $blockProperty->getValue();

            if (!$blockProperty->getIsMultiple()) {
                $data = [$data];
            }

            $data = array_filter($data);

            $len = count($data);

            // init properties
            $typeProperty = new Property('type', '', 'text_line');
            $lengthProperty = new Property('length', '', 'text_line');

            //save length
            $lengthProperty->setValue($len);
            $contentType = $this->contentTypeManager->get($lengthProperty->getContentTypeName());
            $contentType->write(
                $node,
                new BlockPropertyWrapper($lengthProperty, $property),
                $userId,
                $webspaceKey,
                $languageCode,
                $segmentKey
            );

            for ($i = 0; $i < $len; ++$i) {
                $blockPropertyType = $blockProperty->getProperties($i);

                // save type property
                $this->writeProperty(
                    $typeProperty,
                    $property,
                    $blockPropertyType->getName(),
                    $i,
                    $node,
                    $userId,
                    $webspaceKey,
                    $languageCode,
                    $segmentKey,
                    $isImport
                );

                foreach ($blockProperty->getProperties($i)->getChildProperties() as $subProperty) {
                    $this->writeProperty(
                        $subProperty,
                        $property,
                        $subProperty->getValue(),
                        $i,
                        $node,
                        $userId,
                        $webspaceKey,
                        $languageCode,
                        $segmentKey,
                        $isImport
                    );
                }
            }
        } else {
            throw new UnexpectedPropertyType($property, $this);
        }
    }