-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #95 Autowire factories and repositories by class and name (pa…
…mil) This PR was merged into the 1.6-dev branch. Discussion ---------- Replaces and bases on Sylius/Sylius#10217 by @loic425. Allows for autowiring `FactoryClass $resourceFactory` and `RepositoryClass $resourceRepository`. Commits ------- d4f26d0 Provide failing test for autowiring factories and repositories by class adbed78 Implement autowiring factories and repositories by class c0d3cf4 Make tests passing
- Loading branch information
Showing
5 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Bundle/test/src/AppBundle/Service/NoInterfaceAutowiredService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Service; | ||
|
||
use AppBundle\Factory\BookFactory; | ||
use AppBundle\Repository\BookRepository; | ||
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; | ||
use Sylius\Component\Resource\Factory\Factory; | ||
|
||
final class NoInterfaceAutowiredService | ||
{ | ||
/** @var BookFactory */ | ||
private $bookFactory; | ||
|
||
/** @var BookRepository */ | ||
private $bookRepository; | ||
|
||
/** @var Factory */ | ||
private $comicBookFactory; | ||
|
||
/** @var EntityRepository */ | ||
private $comicBookRepository; | ||
|
||
public function __construct( | ||
BookFactory $bookFactory, | ||
BookRepository $bookRepository, | ||
Factory $comicBookFactory, | ||
EntityRepository $comicBookRepository | ||
) { | ||
$this->bookFactory = $bookFactory; | ||
$this->bookRepository = $bookRepository; | ||
$this->comicBookFactory = $comicBookFactory; | ||
$this->comicBookRepository = $comicBookRepository; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters