File tree Expand file tree Collapse file tree 4 files changed +62
-2
lines changed
Expand file tree Collapse file tree 4 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ sylius_resource:
2323 translation :
2424 classes :
2525 model : App\Entity\BookTranslation
26+ interface : App\Entity\BookTranslationInterface
2627 form : App\Form\Type\BookTranslationType
2728
2829 app.comic_book :
Original file line number Diff line number Diff line change 1515
1616use Doctrine \ORM \Mapping as ORM ;
1717use Sylius \Resource \Model \AbstractTranslation ;
18- use Sylius \Resource \Model \ResourceInterface ;
1918
2019#[ORM \Entity]
2120#[ORM \MappedSuperclass]
2221#[ORM \Table(name: 'app_book_translation ' )]
23- class BookTranslation extends AbstractTranslation implements ResourceInterface
22+ class BookTranslation extends AbstractTranslation implements BookTranslationInterface
2423{
2524 #[ORM \Id]
2625 #[ORM \GeneratedValue]
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Sylius package.
5+ *
6+ * (c) Sylius Sp. z o.o.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ declare (strict_types=1 );
13+
14+ namespace App \Entity ;
15+
16+ use Sylius \Resource \Model \ResourceInterface ;
17+
18+ interface BookTranslationInterface extends ResourceInterface
19+ {
20+ public function getTitle (): ?string ;
21+
22+ public function setTitle (?string $ title ): void ;
23+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Sylius package.
5+ *
6+ * (c) Sylius Sp. z o.o.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ declare (strict_types=1 );
13+
14+ namespace Bundle \EventListener ;
15+
16+ use App \Entity \BookTranslationInterface ;
17+ use Doctrine \ORM \EntityManagerInterface ;
18+ use Doctrine \ORM \EntityRepository ;
19+ use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
20+
21+ final class ORMTranslatableListenerTest extends KernelTestCase
22+ {
23+ public function testGettingTranslationRepositoryByItsInterface (): void
24+ {
25+ self ::bootKernel ();
26+
27+ $ this ->assertInstanceOf (
28+ EntityRepository::class,
29+ $ this ->getEntityManager ()->getRepository (BookTranslationInterface::class),
30+ );
31+ }
32+
33+ private function getEntityManager (): EntityManagerInterface
34+ {
35+ return $ this ->getContainer ()->get (EntityManagerInterface::class);
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments