<?php

class testTask extends exchangeImportTask
{
    protected $con = null;
    protected function configure()
    {
        // // add your own arguments here
        $this->addArguments(array(
            new sfCommandArgument('action', sfCommandArgument::REQUIRED ),
        ));
    
        $this->addOptions(array(
            new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'www'),
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'arm'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
            // add your own options here
        ));
    
        $this->namespace        = 'test';
        $this->name             = 'app';
        $this->briefDescription = '';
        $this->detailedDescription = <<<EOF
The [exchange:import|INFO] task does things.
Call it with:

  [php symfony exchange:import|INFO]
EOF;
    }
    public function execute($arguments = array(), $options = array())
    {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $this->con = $databaseManager->getDatabase($options['connection'])->getConnection();
    $instance = sfContext::createInstance($this->configuration);
      if(method_exists($this, $arguments['action'])) {
         
          $this->{$arguments['action']}();
      }
    }
    public function genBasketProducts()
    {
        /** @var Basket $basket */
        $basket = BasketTable::getInstance()->find(1);
        $product = ProductTable::getInstance()->find(7);
        $offer = OfferTable::getInstance()->find(3);
        
       $basket->addOrUpdate($product);
       $basket->addOrUpdate($offer);
       
    }
}