Skip to content

Commit b08035b

Browse files
committed
Docs chapter 2
Signed-off-by: Howriq <[email protected]>
1 parent 0a4d93d commit b08035b

File tree

13 files changed

+12
-31
lines changed

13 files changed

+12
-31
lines changed

docs/book/v1/chapter-2.md

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ Along with those we also need to create the file `config/cli-config.php`.
4444
This `cli-config.php` file sets up Doctrine so that you can run **migration commands** from the command line (CLI).
4545
It connects the Doctrine Migrations system with your application's existing `EntityManager`.
4646

47-
![cli-config](images/chapter-2/cli-config.png)
48-
4947
```php
5048
<?php
5149

@@ -73,8 +71,6 @@ In our latest releases we have decided to switch from a `binary UUID to a string
7371
Because of that, we are also implementing our own custom UUID type in the folder `src/App/src/DBAL/Types/UuidType.php`.
7472
With this method we can also add our own custom types in the future.
7573

76-
![uuid-type](images/chapter-2/uuid-type.png)
77-
7874
```php
7975
<?php
8076

@@ -97,10 +93,8 @@ class UuidType extends \Ramsey\Uuid\Doctrine\UuidType
9793

9894
## Testing Our Doctrine Migrations Configuration
9995

100-
For easier usage of this functionality we will create a file `bin/doctrine-migrations`.
101-
This will give us an easier way of calling the `migrations` functionality.
102-
103-
![doctrine-migrations](images/chapter-2/doctrine-migrations.png)
96+
For easier usage of this functionality, we will create a file `bin/doctrine-migrations`.
97+
This will give us an easier way of executing `migrations` operations.
10498

10599
```php
106100
#!/usr/bin/env php
@@ -139,15 +133,11 @@ The call should lead to a call that contains the following output:
139133

140134
## Creating our Entities
141135

142-
Now that we have set up the Doctrine Migrations we shall now start working on our entities.
136+
Now that we have set up the Doctrine Migrations, we shall now start working on our entities.
143137

144-
We need to create a base for our entities so that they can have the same starting point.
138+
We need to create a base for our entities so that they have the same starting point.
145139
For that, we will add a new directory `src/App/src/Entiy` in which we will add an abstract class, `AbstractEntity.php`:
146140

147-
![abstract-entity-1](images/chapter-2/abstract-entity-1.png)
148-
![abstract-entity-2](images/chapter-2/abstract-entity-2.png)
149-
![abstract-entity-3](images/chapter-2/abstract-entity-3.png)
150-
151141
```php
152142
<?php
153143

@@ -263,9 +253,6 @@ It is time to finally time to work on our `Book` Entity.
263253
We now create a new module with the location `src/Book/src`.
264254
In this module we create a directory called `Entity` in which we shall create our `Book.php` class.
265255

266-
![book-1](images/chapter-2/book-1.png)
267-
![book-2](images/chapter-2/book-2.png)
268-
269256
```php
270257
<?php
271258

@@ -326,13 +313,13 @@ class Book extends AbstractEntity
326313
}
327314
```
328315

329-
In the book class you can see various Doctrine tags such as `#[ORM\Table(name: 'books')]` which specifies the name of the table that will be related to this Entity.
330-
There are plenty of tags that can be added, but for the sake of simplicity we shall just stick to the table and the columns that will populate it.
316+
In the book class you can see various Doctrine tags such as `#[ORM\Table(name: 'books')]` which specify the name of the table that will be related to this Entity.
317+
There are many tags that can be added, but for the sake of simplicity, we will stick to the table and the columns that will populate it.
331318

332319
## Repositories
333320

334-
In the class that we have created previously you might have noticed that our Entity is related to a Repository: `#[ORM\Entity(repositoryClass: BookRepository::class)]`.
335-
We have specified which Repository will handle queries for this Entity.
321+
In the class we created earlier, you may have noticed that our Entity is linked to a Repository using the following annotation: `#[ORM\Entity(repositoryClass: BookRepository::class)]`.
322+
This specifies which Repository will handle queries for this Entity.
336323
This allows us to write custom database logic for it.
337324

338325
Same as for the Entities, we need to create a base and our future Repositories.
@@ -342,8 +329,6 @@ Two repositories shall be created:
342329

343330
- `src/App/src/Repository/AbstractRepository.php`
344331

345-
![abstract-repo](images/chapter-2/abstract-repo.png)
346-
347332
```php
348333
<?php
349334

@@ -381,8 +366,6 @@ class AbstractRepository extends EntityRepository
381366

382367
- `src/App/src/Book/BookRepository.php`
383368

384-
![book-repo](images/chapter-2/book-repo.png)
385-
386369
```php
387370
<?php
388371

@@ -400,8 +383,8 @@ class BookRepository extends AbstractRepository
400383
}
401384
```
402385

403-
The `BookRepository.php` for example, can implement a function that list the books based on certain authors, or titles.
404-
That will not be covered in this tutorial.
386+
The `BookRepository.php`, for example, can implement functions that list books based on specific authors or titles.
387+
However, this will not be covered in this chapter of the tutorial.
405388

406389
## Final Steps
407390

@@ -413,11 +396,9 @@ We have 3 final steps:
413396

414397
### Step 1
415398

416-
In order to register our new module we need a new `ConfigProvider.php` in our `src/Book/src` folder.
399+
In order to register our new module, we need a new `ConfigProvider.php` in our `src/Book/src` folder.
417400
In this class we configure Doctrine to know from where to get our Entities.
418401

419-
![book-config](images/chapter-2/book-config.png)
420-
421402
```php
422403
<?php
423404

-30.5 KB
Binary file not shown.
-17.9 KB
Binary file not shown.
-17.8 KB
Binary file not shown.
-25.7 KB
Binary file not shown.
-22 KB
Binary file not shown.
-8.82 KB
Binary file not shown.
-17 KB
Binary file not shown.
-8.4 KB
Binary file not shown.
-18.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)