This application is a factory simulator. In terms of operations, the factory runs six days a week (Monday through Saturday). In addition to Sundays, the factory doesn’t run on Christmas Eve, Christmas, New Year’s Eve, and New Year. On the days which the factory runs, it operates on 4 hour shifts starting at midnight with a 2 hour break between each shift.
To keep track of things, the factory requires reports to be generated. In particular, three reports are required:
- A production report which is expected at the end of each day
- An incident report which is expected after every shift
- A compensation report which is expected on the last day of the month
This application shows how to use the Symfony scheduler to handle the nuances associated with this task.
- PHP 8.4 or above
- PDO-SQLite PHP extension enabled;
- Git
- Composer
- Symfony CLI
- and the usual Symfony application requirements.
- Clone the repository
git clone https://github.com/ybjozee/symfony_scheduler_demo.git
cd symfony_scheduler_demo- Install dependencies
composer install- Update
DATABASE_URLas required - by default, SQLite is used
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"- Setup database and transports
symfony console doctrine:database:create
symfony console make:migration
symfony console doctrine:migrations:migrate -n
symfony console messenger:setup-transports
symfony console doctrine:fixtures:load -n- Debug schedule
symfony console debug:schedule- Consume
asynctransport
symfony console messenger:consume -v async- Consume
scheduler_defaulttransport
symfony console messenger:consume -v scheduler_default