Skip to content

Commit

Permalink
fix: Removed NodeTypeInterface from Node constructor, Removed ThemeRo…
Browse files Browse the repository at this point in the history
…utesLoader.php

BREAKING CHANGE: Node constructor does not accept any argument anymore.
  • Loading branch information
ambroisemaupate committed Mar 15, 2024
1 parent 4c72de2 commit 0816525
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 93 deletions.
6 changes: 1 addition & 5 deletions config/packages/monolog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ when@prod:
nested:
type: stream
path: php://stderr
level: debug
level: info
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
channels: [deprecation]
path: php://stderr
2 changes: 0 additions & 2 deletions lib/RoadizCompatBundle/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ services:
roadiz_compat.twig_loader:
class: Twig\Loader\FilesystemLoader
tags: ['twig.loader']
RZ\Roadiz\CompatBundle\Routing\ThemeRoutesLoader:
tags: [ routing.loader ]

#
# Made routers theme aware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public function process(ContainerBuilder $container): void
}
}

/**
* @throws \ReflectionException
*/
private function registerThemeTranslatorResources(ContainerBuilder $container): void
{
/** @var string $projectDir */
Expand Down
75 changes: 0 additions & 75 deletions lib/RoadizCompatBundle/src/Routing/ThemeRoutesLoader.php

This file was deleted.

1 change: 0 additions & 1 deletion lib/RoadizCoreBundle/config/packages/roadiz_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ roadiz_core:
# Be careful if you are using a reverse-proxy cache, YOU MUST vary on Accept-Language header and normalize it.
# @see https://varnish-cache.org/docs/6.3/users-guide/increasing-your-hitrate.html#http-vary
useAcceptLanguageHeader: '%env(bool:APP_USE_ACCEPT_LANGUAGE_HEADER)%'
themes: []
medias:
unsplash_client_id: '%env(string:APP_UNSPLASH_CLIENT_ID)%'
soundcloud_client_id: '%env(string:APP_SOUNDCLOUD_CLIENT_ID)%'
Expand Down
4 changes: 0 additions & 4 deletions lib/RoadizCoreBundle/config/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ healthCheckAction:
stateless: true
controller: RZ\Roadiz\CoreBundle\Controller\HealthCheckController

roadiz_core_themes:
resource: .
type: themes

api_login_check:
methods: [POST]
stateless: true
Expand Down
4 changes: 1 addition & 3 deletions lib/RoadizCoreBundle/src/Entity/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class Node extends AbstractDateTimedPositioned implements LeafInterface, Attribu
/**
* Create a new empty Node according to given node-type.
*/
public function __construct(NodeTypeInterface $nodeType = null)
public function __construct()
{
$this->nodesTags = new ArrayCollection();
$this->children = new ArrayCollection();
Expand All @@ -328,8 +328,6 @@ public function __construct(NodeTypeInterface $nodeType = null)
$this->aNodes = new ArrayCollection();
$this->bNodes = new ArrayCollection();
$this->attributeValues = new ArrayCollection();

$this->setNodeType($nodeType);
$this->initAbstractDateTimed();
}

Expand Down
3 changes: 2 additions & 1 deletion lib/RoadizCoreBundle/src/Node/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public function create(
}

if ($node === null) {
$node = new Node($type);
$node = new Node();
$node->setNodeType($type);
}

if ($type instanceof NodeType) {
Expand Down
1 change: 1 addition & 0 deletions lib/RoadizCoreBundle/src/Node/NodeTranstyper.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ protected function mockTranstype(NodeTypeInterface $nodeType): void
* transtype, not to get an orphan node.
*/
$node = new Node();
$node->setNodeType($nodeType);
$node->setNodeName('testing_before_transtype' . $uniqueId);
$this->getManager()->persist($node);

Expand Down
3 changes: 2 additions & 1 deletion lib/RoadizCoreBundle/src/Node/UniqueNodeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public function generate(
bool $pushToTop = false
): NodesSources {
$name = $nodeType->getDisplayName() . " " . uniqid();
$node = new Node($nodeType);
$node = new Node();
$node->setNodeType($nodeType);
$node->setTtl($nodeType->getDefaultTtl());

if (null !== $tag) {
Expand Down
4 changes: 3 additions & 1 deletion lib/Rozier/src/Controllers/Nodes/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ public function addAction(Request $request, int $nodeTypeId, ?int $translationId
throw new ResourceNotFoundException(sprintf('Translation #%s does not exist.', $translationId));
}

$node = new Node($type);
$node = new Node();
$node->setNodeType($type);

$chroot = $this->nodeChrootResolver->getChroot($this->getUser());
if (null !== $chroot) {
// If user is jailed in a node, prevent moving nodes out.
Expand Down

0 comments on commit 0816525

Please sign in to comment.