Create new resource
Create the entity
$ bin/console make:entity 'App\Entity\Book'Name
Author
Description
Price
created: src/Entity/Book.php
created: src/Repository/BookRepository.php
Entity generated! Now let's add some fields!
You can always add more fields later manually or by re-running this command.
New property name (press <return> to stop adding fields):
> name
Field type (enter ? to see all types) [string]:
>
Field length [255]:
>
Can this field be null in the database (nullable) (yes/no) [no]:
>
updated: src/Entity/Book.php
Add another property? Enter the property name (or press <return> to stop adding fields):
> author
Field type (enter ? to see all types) [string]:
>
Field length [255]:
>
Can this field be null in the database (nullable) (yes/no) [no]:
>
updated: src/Entity/Book.php
Add another property? Enter the property name (or press <return> to stop adding fields):
> description
Field type (enter ? to see all types) [string]:
> text
Can this field be null in the database (nullable) (yes/no) [no]:
>
updated: src/Entity/Book.php
Add another property? Enter the property name (or press <return> to stop adding fields):
> price
Field type (enter ? to see all types) [string]:
> float
Can this field be null in the database (nullable) (yes/no) [no]:
>
updated: src/Entity/Book.php
Add another property? Enter the property name (or press <return> to stop adding fields):
>
Success!
Next: When you're ready, create a migration with php bin/console make:migration
Configure the BookRepository
Last updated
Was this helpful?
