Bonjour,

J'ai créé une command symfony avec différents arguments
je souhaite accéder à mon contoller mais lorsque j'appelle une function j'ai des erreurs

mes erreurs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
PHP Fatal error:  Call to a member function has() on a non-object in D:\wamp\www\extract\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php on line 191
PHP Stack trace:
PHP   1. {main}() D:\wamp\www\extract\app\console:0
PHP   2. Symfony\Component\Console\Application->run() D:\wamp\www\extract\app\console:25
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() D:\wamp\www\extract\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:105
PHP   4. Symfony\Component\Console\Application->doRun() D:\wamp\www\extract\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:78
PHP   5. Symfony\Component\Console\Command\Command->run() D:\wamp\www\extract\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:192
PHP   6. Test\MonBundle\Command\LaunchExtractCommand->execute() D:\wamp\www\extract\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:238
PHP   7. Test\MonBundle\Controller\ExtractController->launchAction() D:\wamp\www\extract\src\Test\MonBundle\Command\LaunchExtractCommand.php:57
PHP   8. Symfony\Bundle\FrameworkBundle\Controller\Controller->getDoctrine() D:\wamp\www\extract\src\Test\MonBundle\Controller\ExtractController.php:101
Mon controller

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
namespace Test\TestBundle\Command;
 
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestBundle\Controller\MonController;
 
.........
 
 protected function execute(InputInterface $input, OutputInterface $output)
    {
        $array_param   = array();
        $array_mail     = array();
 
 
        $mail = $input->getOption('mail');
        $array_mail = explode(',',$mail[0]);
 
        $param = $input->getOption('param');
        $array_param = explode(',',$param[0]);
 
        $action= new MonController();
        $action->lancerAction();
 
    }
Comment faire pour accéder à mon controller existant?

Merci d'avance