after reading /cookbook/1_1/en/tasks i try my first "task in task"
example, and it failed :(
here is the example:
i create first a father-task-class: #symfony generate:task theBase
class theBaseTask extends sfBaseTask
{
protected function configure()
{
$this->namespace = 'use';
$this->briefDescription = '';
$this->detailedDescription = '';
$this->addArgument('number', sfCommandArgument::REQUIRED, 'some
integer please');
$this->addOption('env', null, sfCommandOption::PARAMETER_REQUIRED,
'The environment', 'dev');
}
protected function execute($arguments = array(), $options = array())
{
// add code here
}
}
then i create the first task: #symfony generate:task myFirst
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'theBaseTask.class.php');
class myFirstTask extends theBaseTask
{
protected function configure()
{
parent::configure();
$this->name = 'first';
}
protected function execute($arguments = array(), $options = array())
{
$this->logSection('The Answer to Life, the Universe, and
Everything is:', $arguments['number']);
}
}
and finally i create the second task: #symfony generate:task mySecond
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'theBaseTask.class.php');
class mySecondTask extends theBaseTask
{
protected function configure()
{
parent::configure();
$this->name = 'second';
}
protected function execute($arguments = array(), $options = array())
{
$erster = new myFirstTask($this->dispatcher, $this->formatter);
$erster->run(array('number'=>$arguments['number']++), $options);
}
}
now try to run this, first the base:
# symfony use:the-base
> The execution of task "use:the-base" failed.
> - Not enough arguments.
>symfony use:the-base [--env="..."] number
and with argument:
# symfony use:the-base 42
nothing happend. sounds good to me, now i'm trying to run the first
task:
# symfony use:first 42
>> The Answer to Life, the Universe, and Everything is: 42
perfect! now i know the answer to Life and Everything else!
and now try run the second task, which try to execute the first-task:
# symfony use:second 42
PHP Fatal error: Call to a member function withTrace() on a non-
object in /usr/share/php/symfony/task/sfBaseTask.class.php on line 65
Fatal error: Call to a member function withTrace() on a non-object in /
usr/share/php/symfony/task/sfBaseTask.class.php on line 65
oops, whats that?
have anybody a idea, where i make i mistake? or is it really a bug?
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---