Skip to content

Commit e5d06c5

Browse files
authored
Improve README code examples by adding use statements (#60)
for people who cut and paste...
1 parent e7b8dd1 commit e5d06c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Let's say you have an existing Doctrine entity `Document` that looks like this:
6262

6363
```php
6464
<?php
65+
namespace App\Entity;
6566

6667
use Doctrine\ORM\Mapping as ORM;
6768

@@ -106,6 +107,8 @@ This will lead you to something like the following, with some code skipped for b
106107
```php
107108
<?php
108109

110+
namespace App\Entity;
111+
109112
use Doctrine\Common\Collections\Collection;
110113
use Doctrine\Common\Collections\ArrayCollection;
111114
use Doctrine\ORM\Mapping as ORM;
@@ -153,9 +156,13 @@ Your code should look similar to this:
153156

154157
```php
155158
<?php
159+
160+
namespace App\Entity;
156161

157162
use Doctrine\ORM\Mapping as ORM;
158163
use Webfactory\Bundle\PolyglotBundle\Entity\BaseTranslation;
164+
use Webfactory\Bundle\PolyglotBundle\Attribute as Polyglot;
165+
use Webfactory\Bundle\PolyglotBundle\TranslatableInterface;
159166

160167
#[ORM\Table]
161168
#[ORM\UniqueConstraint(columns: ['entity_id', 'locale'])]
@@ -171,7 +178,7 @@ class DocumentTranslation
171178
#[Polyglot\Locale]
172179
private string $locale;
173180

174-
#[ORM\ManyToOne(targetEntity: \Document::class, inversedBy: 'translations')]
181+
#[ORM\ManyToOne(targetEntity: Document::class, inversedBy: 'translations')]
175182
private Document $entity;
176183

177184
public function getLocale(): string

0 commit comments

Comments
 (0)