Skip to content

Commit

Permalink
Merge branch feature/orm-2.17 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Dec 2, 2023
1 parent 5ea985c commit 3e3f51b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.8.1",
"doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.14.1 < 2.17",
"doctrine/orm": "~2.17.0",
"gedmo/doctrine-extensions": "^3.10.0",
"inlinestyle/inlinestyle": "~1.2.7",
"james-heinrich/getid3": "^1.9",
Expand Down
1 change: 0 additions & 1 deletion src/Entity/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class Document extends AbstractDateTimed implements AdvancedDocumentInterface, H
#[ORM\OneToMany(
mappedBy: 'document',
targetEntity: DocumentTranslation::class,
fetch: 'EAGER',
orphanRemoval: true
)]
#[SymfonySerializer\Ignore]
Expand Down
1 change: 0 additions & 1 deletion src/Entity/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Setting extends AbstractEntity
#[ORM\ManyToOne(
targetEntity: SettingGroup::class,
cascade: ['persist', 'merge'],
fetch: 'EAGER',
inversedBy: 'settings'
)]
#[ORM\JoinColumn(name: 'setting_group_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
Expand Down
1 change: 0 additions & 1 deletion src/Entity/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class Tag extends AbstractDateTimedPositioned implements LeafInterface
mappedBy: 'tag',
targetEntity: TagTranslation::class,
cascade: ['all'],
fetch: 'EAGER',
orphanRemoval: true
)]
#[SymfonySerializer\Groups(['translated_tag'])]
Expand Down
20 changes: 4 additions & 16 deletions src/Repository/NodesSourcesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,29 +217,17 @@ public function alterQueryBuilderWithAuthorizationChecker(
* Forbid deleted node for backend user when authorizationChecker not null.
*/
if (!$this->hasJoinedNode($qb, $prefix)) {
$qb->innerJoin(
$prefix . '.node',
static::NODE_ALIAS,
'WITH',
$qb->expr()->lte(static::NODE_ALIAS . '.status', Node::PUBLISHED)
);
} else {
$qb->andWhere($qb->expr()->lte(static::NODE_ALIAS . '.status', Node::PUBLISHED));
$qb->innerJoin($prefix . '.node', static::NODE_ALIAS);
}
$qb->andWhere($qb->expr()->lte(static::NODE_ALIAS . '.status', Node::PUBLISHED));
} else {
/*
* Forbid unpublished node for anonymous and not backend users.
*/
if (!$this->hasJoinedNode($qb, $prefix)) {
$qb->innerJoin(
$prefix . '.node',
static::NODE_ALIAS,
'WITH',
$qb->expr()->eq(static::NODE_ALIAS . '.status', Node::PUBLISHED)
);
} else {
$qb->andWhere($qb->expr()->eq(static::NODE_ALIAS . '.status', Node::PUBLISHED));
$qb->innerJoin($prefix . '.node', static::NODE_ALIAS);
}
$qb->andWhere($qb->expr()->eq(static::NODE_ALIAS . '.status', Node::PUBLISHED));
}
return $qb;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/TagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function filterByTranslation(
$qb->leftJoin('tg.translatedTags', 'tt');
$qb->leftJoin(
'tt.translation',
static::TRANSLATION_ALIAS,
self::TRANSLATION_ALIAS,
'WITH',
't.defaultTranslation = true'
);
Expand Down

0 comments on commit 3e3f51b

Please sign in to comment.