buildPropertyMappingConfiguration() 공개 메소드

Builds the default property mapping configuration.
public buildPropertyMappingConfiguration ( string $type = PropertyMappingConfiguration::class ) : PropertyMappingConfiguration
$type string the implementation class name of the PropertyMappingConfiguration to instantiate; must be a subclass of Neos\Flow\Property\PropertyMappingConfiguration
리턴 PropertyMappingConfiguration
예제 #1
0
 /**
  * @test
  */
 public function getTargetPropertyNameShouldReturnTheUnmodifiedPropertyNameWithoutConfiguration()
 {
     $defaultConfiguration = $this->propertyMapper->buildPropertyMappingConfiguration();
     $this->assertTrue($defaultConfiguration->getConfigurationValue(\Neos\Flow\Property\TypeConverter\PersistentObjectConverter::class, \Neos\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED));
     $this->assertTrue($defaultConfiguration->getConfigurationValue(\Neos\Flow\Property\TypeConverter\PersistentObjectConverter::class, \Neos\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED));
     $this->assertNull($defaultConfiguration->getConfigurationFor('foo')->getConfigurationValue(\Neos\Flow\Property\TypeConverter\PersistentObjectConverter::class, \Neos\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED));
     $this->assertNull($defaultConfiguration->getConfigurationFor('foo')->getConfigurationValue(\Neos\Flow\Property\TypeConverter\PersistentObjectConverter::class, \Neos\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED));
 }
예제 #2
0
 /**
  * Publishes or discards the given nodes
  *
  * @param array $nodes <\Neos\ContentRepository\Domain\Model\NodeInterface> $nodes
  * @param string $action
  * @param Workspace $selectedWorkspace
  * @throws \Exception
  * @throws \Neos\Flow\Property\Exception
  * @throws \Neos\Flow\Security\Exception
  */
 public function publishOrDiscardNodesAction(array $nodes, $action, Workspace $selectedWorkspace = null)
 {
     $propertyMappingConfiguration = $this->propertyMapper->buildPropertyMappingConfiguration();
     $propertyMappingConfiguration->setTypeConverterOption(NodeConverter::class, NodeConverter::REMOVED_CONTENT_SHOWN, true);
     foreach ($nodes as $key => $node) {
         $nodes[$key] = $this->propertyMapper->convert($node, NodeInterface::class, $propertyMappingConfiguration);
     }
     switch ($action) {
         case 'publish':
             foreach ($nodes as $node) {
                 $this->publishingService->publishNode($node);
             }
             $this->addFlashMessage($this->translator->translateById('workspaces.selectedChangesHaveBeenPublished', [], null, null, 'Modules', 'Neos.Neos'));
             break;
         case 'discard':
             $this->publishingService->discardNodes($nodes);
             $this->addFlashMessage($this->translator->translateById('workspaces.selectedChangesHaveBeenDiscarded', [], null, null, 'Modules', 'Neos.Neos'));
             break;
         default:
             throw new \RuntimeException('Invalid action "' . htmlspecialchars($action) . '" given.', 1346167441);
     }
     $this->redirect('show', null, null, ['workspace' => $selectedWorkspace]);
 }