Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ActiveDistributionsInAdvanceController.php 992B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace console\commands;
  3. use common\logic\Distribution\Distribution\Wrapper\DistributionManager;
  4. use common\logic\Producer\Producer\Wrapper\ProducerManager;
  5. use yii\console\Controller;
  6. class ActiveDistributionsInAdvanceController extends Controller
  7. {
  8. public function actionIndex()
  9. {
  10. $producerManager = ProducerManager::getInstance();
  11. $distributionManager = DistributionManager::getInstance();
  12. $producersArray = $producerManager->findProducersActive();
  13. foreach($producersArray as $producer) {
  14. \Yii::$app->logic->setProducerContext($producer);
  15. $weeksDistributionsActivatedInAdvance = $producerManager->getConfig('option_weeks_distributions_activated_in_advance');
  16. if($weeksDistributionsActivatedInAdvance) {
  17. $date = new \DateTime('+'.$weeksDistributionsActivatedInAdvance.' weeks');
  18. $distributionManager->activeDistributionByDate($date);
  19. }
  20. }
  21. }
  22. }
  23. ?>