Skip to content

Commit 7a22f63

Browse files
committed
Code chapter 2
Signed-off-by: Howriq <[email protected]>
1 parent 8ff4031 commit 7a22f63

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/App/src/ConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ private function getDoctrineConfig(): array
173173
'executed_at_column_name' => 'executed_at',
174174
'execution_time_column_name' => 'execution_time',
175175
],
176-
// Modify this line based on where you would like to have you migrations
176+
// Modify this line based on where you would like to have your migrations
177177
'migrations_paths' => [
178178
'Migrations' => 'src/App/src/Migration',
179179
],

src/Book/src/Entity/Book.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
use Doctrine\ORM\Mapping as ORM;
88
use Light\App\Entity\AbstractEntity;
99
use Light\Book\Repository\BookRepository;
10+
use Ramsey\Uuid\UuidInterface;
1011

1112
#[ORM\Entity(repositoryClass: BookRepository::class)]
1213
#[ORM\Table(name: 'books')]
1314
#[ORM\HasLifecycleCallbacks]
1415
class Book extends AbstractEntity
1516
{
16-
#[ORM\Column(name: 'title', type: 'string', length: 500, nullable: true)]
17-
private ?string $title = null;
17+
#[ORM\Column(name: 'title', type: 'string', length: 500)]
18+
private string $title;
1819

19-
#[ORM\Column(name: 'author', type: 'string', length: 500, nullable: true)]
20-
private ?string $author = null;
20+
#[ORM\Column(name: 'author', type: 'string', length: 500)]
21+
private string $author;
2122

2223
public function getTitle(): ?string
2324
{
@@ -41,13 +42,15 @@ public function setAuthor(string $author): void
4142

4243
/**
4344
* @return array{
44-
* title: string|null,
45-
* author: string|null
45+
* id: UuidInterface,
46+
* title: string,
47+
* author: string
4648
* }
4749
*/
4850
public function getArrayCopy(): array
4951
{
5052
return [
53+
'id' => $this->id,
5154
'title' => $this->title,
5255
'author' => $this->author,
5356
];

0 commit comments

Comments
 (0)