Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/8.3' into 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 28, 2025
2 parents f69e400 + b42c146 commit f239a20
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 11 deletions.
15 changes: 14 additions & 1 deletion Neos.ContentRepository/Classes/Domain/Model/Node.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Neos\ContentRepository\Domain\Model;

/*
Expand Down Expand Up @@ -1349,7 +1350,7 @@ public function setRemoved($removed): void
$this->materializeNodeData();
}

if ((boolean)$removed === true) {
if ((bool)$removed === true) {
/** @var $childNode Node */
foreach ($this->getChildNodes() as $childNode) {
$childNode->setRemoved(true);
Expand Down Expand Up @@ -1389,10 +1390,13 @@ public function setHidden($hidden): void
if ($this->isHidden() === $hidden) {
return;
}
$oldValue = $this->isHidden();
$this->emitBeforeNodePropertyChange($this, '_hidden', $oldValue, $hidden);
$this->materializeNodeDataAsNeeded();
$this->nodeData->setHidden($hidden);

$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodePropertyChanged($this, '_hidden', $oldValue, $hidden);
$this->emitNodeUpdated($this);
}

Expand Down Expand Up @@ -1421,10 +1425,13 @@ public function setHiddenBeforeDateTime(?\DateTimeInterface $dateTime = null): v
if ($this->getHiddenBeforeDateTime() instanceof \DateTime && $dateTime instanceof \DateTime && $this->getHiddenBeforeDateTime()->format(\DateTime::W3C) === $dateTime->format(\DateTime::W3C)) {
return;
}
$oldValue = $this->getHiddenBeforeDateTime();
$this->emitBeforeNodePropertyChange($this, '_hiddenBeforeDateTime', $oldValue, $dateTime);
$this->materializeNodeDataAsNeeded();
$this->nodeData->setHiddenBeforeDateTime($dateTime);

$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodePropertyChanged($this, '_hiddenBeforeDateTime', $oldValue, $dateTime);
$this->emitNodeUpdated($this);
}

Expand Down Expand Up @@ -1452,10 +1459,13 @@ public function setHiddenAfterDateTime(?\DateTimeInterface $dateTime = null): vo
if ($this->getHiddenAfterDateTime() instanceof \DateTimeInterface && $dateTime instanceof \DateTimeInterface && $this->getHiddenAfterDateTime()->format(\DateTime::W3C) === $dateTime->format(\DateTime::W3C)) {
return;
}
$oldValue = $this->getHiddenAfterDateTime();
$this->emitBeforeNodePropertyChange($this, '_hiddenAfterDateTime', $oldValue, $dateTime);
$this->materializeNodeDataAsNeeded();
$this->nodeData->setHiddenAfterDateTime($dateTime);

$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodePropertyChanged($this, '_hiddenAfterDateTime', $oldValue, $dateTime);
$this->emitNodeUpdated($this);
}

Expand Down Expand Up @@ -1483,10 +1493,13 @@ public function setHiddenInIndex($hidden): void
if ($this->isHiddenInIndex() === $hidden) {
return;
}
$oldValue = $this->isHiddenInIndex();
$this->emitBeforeNodePropertyChange($this, '_hiddenInIndex', $oldValue, $hidden);
$this->materializeNodeDataAsNeeded();
$this->nodeData->setHiddenInIndex($hidden);

$this->context->getFirstLevelNodeCache()->flush();
$this->emitNodePropertyChanged($this, '_hiddenInIndex', $oldValue, $hidden);
$this->emitNodeUpdated($this);
}

Expand Down
16 changes: 12 additions & 4 deletions Neos.ContentRepository/Classes/Domain/Model/NodeData.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Neos\ContentRepository\Domain\Model;

/*
Expand Down Expand Up @@ -475,9 +476,9 @@ public function createNodeData($name, ?NodeType $nodeType = null, $identifier =
* @param string $identifier The identifier of the node, unique within the workspace, optional(!)
* @param Workspace $workspace
* @param array $dimensions An array of dimension name to dimension values
* @throws NodeExistsException if a node with this path already exists.
* @throws \InvalidArgumentException if the node name is not accepted.
* @return NodeData
* @throws \InvalidArgumentException if the node name is not accepted.
* @throws NodeExistsException if a node with this path already exists.
*/
public function createSingleNodeData($name, ?NodeType $nodeType = null, $identifier = null, ?Workspace $workspace = null, ?array $dimensions = null)
{
Expand Down Expand Up @@ -767,14 +768,21 @@ public function similarize(AbstractNodeData $sourceNode, $isCopy = false)
];
if (!$isCopy) {
$propertyNames[] = 'creationDateTime';
$propertyNames[] = 'lastModificationDateTime';
}
if ($sourceNode instanceof NodeData) {
$propertyNames[] = 'index';
$propertyNames[] = 'removed';
}

// We need to force direct access for the following properties, as they don't have a setter in AbstractNodeData
$propertyNamesToForceDirectAccess = ['creationDateTime'];
foreach ($propertyNames as $propertyName) {
ObjectAccess::setProperty($this, $propertyName, ObjectAccess::getProperty($sourceNode, $propertyName));
ObjectAccess::setProperty(
$this,
$propertyName,
ObjectAccess::getProperty($sourceNode, $propertyName),
in_array($propertyName, $propertyNamesToForceDirectAccess)
);
}

$contentObject = $sourceNode->getContentObject();
Expand Down
48 changes: 48 additions & 0 deletions Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);

namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Make index on movedto unique
*/
final class Version20230430183156 extends AbstractMigration
{
public function getDescription(): string
{
return 'Make index on movedto unique';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'."
);

$this->skipIf(!$schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('IDX_CE6515692D45FE4D')
&& $schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('UNIQ_CE6515692D45FE4D'),
"Skipped index renaming because they are already named properly"
);

$this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'."
);

$this->skipIf($schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('IDX_CE6515692D45FE4D')
&& !$schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('UNIQ_CE6515692D45FE4D'),
"Skipped index renaming because they are already named properly"
);

$this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX UNIQ_CE6515692D45FE4D, ADD INDEX IDX_CE6515692D45FE4D (movedto)');
}
}
18 changes: 18 additions & 0 deletions Neos.ContentRepository/Tests/Unit/Domain/Model/NodeDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,24 @@ public function similarizeClearsPropertiesBeforeAddingNewOnes()
self::assertEquals($expectedProperties, $this->nodeData->getProperties());
}

/**
* @test
*/
public function similarizeCopiesCreationAndLastModificationDateTimes()
{
$creationDateTime = \DateTime::createFromFormat('Y-m-d', '2000-01-01 12:00:00');

/** @var $sourceNode NodeData */
$sourceNode = $this->getAccessibleMock(NodeData::class, ['addOrUpdate'], ['/foo/bar', $this->mockWorkspace]);
$this->inject($sourceNode, 'nodeTypeManager', $this->mockNodeTypeManager);
$sourceNode->_set('nodeDataRepository', $this->createMock(RepositoryInterface::class));
$sourceNode->_set('creationDateTime', $creationDateTime);

$this->nodeData->similarize($sourceNode);

self::assertSame($creationDateTime, $this->nodeData->getCreationDateTime());
}

/**
* @test
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@ public function getY(): ?int

/**
* This setter accepts strings in order to make configuration / mapping of settings easier.
*
* @param AspectRatio | string | null $aspectRatio
*/
public function setAspectRatio($aspectRatio = null): void
public function setAspectRatio(AspectRatio|string|null $aspectRatio = null): void
{
if ($aspectRatio === null) {
$this->aspectRatioAsString = null;
Expand Down
40 changes: 40 additions & 0 deletions Neos.Media/Migrations/Mysql/Version20230430183157.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);

namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Adjust key on Tag domain model to ON DELETE SET NULL
*/
final class Version20230430183157 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adjust key on Tag domain model to ON DELETE SET NULL';
}

public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'."
);

$this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
$this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL');
}

public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform,
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'."
);

$this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F');
$this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier)');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function indexAction(string $searchTerm = '', string $sortBy = 'accounts.
'searchTerm' => $searchTerm,
'sortBy' => $sortBy,
'sortDirection' => $sortDirection,
'settings' => $this->moduleConfiguration['settings']
]);
}

Expand Down
2 changes: 1 addition & 1 deletion Neos.Neos/Classes/EventLog/Domain/Model/NodeEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* indexes={
* @ORM\Index(name="documentnodeidentifier", columns={"documentnodeidentifier"}),
* @ORM\Index(name="workspacename_parentevent", columns={"workspacename", "parentevent"}),
* @ORM\Index(name="dimensionshashindex", columns={"dimensionshash"})
* @ORM\Index(name="dimensionshash", columns={"dimensionshash"})
* }
* )
*/
Expand Down
8 changes: 7 additions & 1 deletion Neos.Neos/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ Neos:
new:
label: 'Neos.Neos:Modules:users.actions.new.label'
title: 'Neos.Neos:Modules:users.actions.new.title'
settings:
pagination:
itemsPerPage: 10
packages:
label: 'Neos.Neos:Modules:packages.label'
controller: 'Neos\Neos\Controller\Module\Administration\PackagesController'
Expand Down Expand Up @@ -617,16 +620,19 @@ Neos:
commandReferences:
'Neos:NeosCommands':
title: 'Neos Command Reference'
packageKeys:
packageKeys: # These are actually no package keys, but rather command controller identifiers extracted out of namespaces.
'Neos.Flow': true
'Neos.Party': true
'Neos.FluidAdaptor': true
'Neos.Kickstarter': true
'Neos.Welcome': true
'Neos.Media': true
'Neos.ContentRepository': true
'Neos.ContentRepository.Migration': true
'Neos.SiteKickstarter': true
'Neos.Neos': true
'Neos.Neos.Setup': true
'Neos.Setup': true
savePathAndFilename: '%FLOW_PATH_PACKAGES%Neos/Neos.Neos/Documentation/References/CommandReference.rst'
references:
'TYPO3Fluid:ViewHelpers':
Expand Down
Loading

0 comments on commit f239a20

Please sign in to comment.