Topics
- OroConfigBundle (adding bundle configuration settings)
- OroCronBundle (adding and running cron jobs)
Changes
src/Acme/Bundle/TaskBundle
Command
SendStatisticsCommand (created)
DependencyInjection
Configuration (updated, added default settings)
AcmeTaskExtension (updated)
Resources
config
system_configuration.yml (created)
services.yml (updated, adding new service)
translations
messages.en.yml (updated)
views
Task
statisticsMail.txt.twig (created)
Model
Statistics (created)
Tests
Unit
DependencyInjection
ConfigurationTest (created)
AcmeTaskExtension (updated)
-
Add Acme/Bundle/TaskBundle/Resources/config/system_configuration.yml
-
Update Acme\Bundle\TaskBundle\DependencyInjection\Configuration
SettingsBuilder::append( $rootNode, array( 'send_statistics_cron_schedule' => array('value' => self::DEFAULT_SEND_STATISTICS_CRON_SCHEDULE), 'send_statistics_email_to' => array('value' => null), 'send_statistics_email_from' => array('value' => null), 'send_statistics_enabled' => array('value' => false, 'type' => 'boolean'), ) );
-
Update Acme\Bundle\TaskBundle\DependencyInjection\AcmeTaskExtension
-
Go to System -> Configuration and check new settings
-
Change "Cron schedule" to "* * * * *" to demonstrate how email will be sent when cron job will be added
- Setup cron in OS
sudo crontab -e
*/1 * * * * /usr/bin/php /path_to_your_project_root/app/console --env=dev oro:cron >> /dev/null
-
Add Acme\Bundle\TaskBundle\Model\Statistics
-
Update services.yml with acme_task.statistics service
-
Add AcmeTaskBundle:Task:statisticsMail.txt.twig
-
Add Acme\Bundle\TaskBundle\Command\SendStatisticsCommand
-
Go to System -> Configuration enter settings for cron job
-
Go to System -> Job Queue and check job executions (ensure that JMSJobQueue daemon is running)