- <?php
-
- namespace console\commands;
-
- use common\logic\Distribution\Distribution\Wrapper\DistributionManager;
- use common\logic\Producer\Producer\Wrapper\ProducerManager;
- use yii\console\Controller;
-
- class ActiveDistributionsInAdvanceController extends Controller
- {
- public function actionIndex()
- {
- $producerManager = ProducerManager::getInstance();
- $distributionManager = DistributionManager::getInstance();
-
- $producersArray = $producerManager->findProducersActive();
- foreach($producersArray as $producer) {
- \Yii::$app->logic->setProducerContext($producer);
- $weeksDistributionsActivatedInAdvance = $producerManager->getConfig('option_weeks_distributions_activated_in_advance');
- if($weeksDistributionsActivatedInAdvance) {
- $date = new \DateTime('+'.$weeksDistributionsActivatedInAdvance.' weeks');
- $distributionManager->activeDistributionByDate($date);
- }
- }
- }
- }
-
- ?>
|