Skip to content

Commit

Permalink
feat!: Pass NodesSources repository entityClass to parent constructor…
Browse files Browse the repository at this point in the history
…. Changed NodesSourcesRepository constructor signature.
  • Loading branch information
ambroisemaupate committed Jul 14, 2024
1 parent 018565d commit aa917f3
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 38 deletions.
4 changes: 1 addition & 3 deletions lib/EntityGenerator/src/RepositoryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);
$this->_entityName = ' . $this->options['entity_namespace'] . '\\' . $this->nodeType->getSourceEntityClassName() . '::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, ' . $this->options['entity_namespace'] . '\\' . $this->nodeType->getSourceEntityClassName() . '::class);
}' . PHP_EOL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock::class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ class NodesSourcesRepository extends StatusAwareRepository
* @param EventDispatcherInterface $dispatcher
* @param Security $security
* @param NodeSourceSearchHandlerInterface|null $nodeSourceSearchHandler
* @param class-string<NodesSources> $entityClass
*/
public function __construct(
ManagerRegistry $registry,
PreviewResolverInterface $previewResolver,
EventDispatcherInterface $dispatcher,
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler,
string $entityClass = NodesSources::class
) {
parent::__construct($registry, NodesSources::class, $previewResolver, $dispatcher, $security);
parent::__construct($registry, $entityClass, $previewResolver, $dispatcher, $security);
$this->nodeSourceSearchHandler = $nodeSourceSearchHandler;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSArticleContainer::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSArticleContainer::class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSArticleFeedBlock::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSArticleFeedBlock::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSArticleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSArticle::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSArticle::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSBasicBlockRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSBasicBlock::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSBasicBlock::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSGroupBlockRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSGroupBlock::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSGroupBlock::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSMenuLinkRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSMenuLink::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSMenuLink::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSMenuRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSMenu::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSMenu::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSNeutralRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSNeutral::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSNeutral::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSOfferRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSOffer::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSOffer::class);
}
}
4 changes: 1 addition & 3 deletions src/GeneratedEntity/Repository/NSPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(
Security $security,
?NodeSourceSearchHandlerInterface $nodeSourceSearchHandler
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \App\GeneratedEntity\NSPage::class;
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler, \App\GeneratedEntity\NSPage::class);
}
}

0 comments on commit aa917f3

Please sign in to comment.