Symfony training at Mall-Connect #2
Jam Jar is a web application which helps people to track their jam storage. When one receives from a granny few jars of strawberry jam – he adds information about them into database. It is possible to write amount of jars, type of jam, year of production and some comment.
Data model consists of 2 enumerations (jam type, year of production) and JamJar entity. Enumerations are simple entities with id + name fields.
JamJar entity fields are:
- jam type(single select)
- year (single select),
- comment (text, optional)
Please, create few values for enumerations and few JamJar instances via Alice fixtures.
Service class should have one public method to fetch all data needed for dashboard. This method should be covered with Unit test – all external calls from the service are replaced by mocks and service class is only one real object in the test, created via “new” operator.
Add to the form of JamJar Quantity field. This field should be available only on “create” form and should not mapped to entity. By default value of field is 1. If during creation of JamJar user changes value to N – then during creation, N instances of JamJar should be created. It would be nice if this multiplying/copying logic would be stored in a service class and covered with unit test.
# composer install
# php bin/console doctrine:database:create
# php bin/console doctrine:schema:update --force
# php bin/console server:run
php bin/console doctrine:fixtures:load