I've struggled with that problem as well, and if any visibility
changes are made then the createTask() method of sfBaseTask should be
set to public as well as it does exactly what you're doing manually
right now.

For the time being, you could use the reflection API to get access to
the protected variables without taking much of a performance hit, or
changing any symfony classes.

kind regards,
Johannes


On 19 Jul., 15:57, Tom Boutell <[email protected]> wrote:
> In principle you should be able to hook the command.post_command event
> to call a second task after a particular task executes.
>
> In practice, to instantiate a task you need the dispatcher, formatter,
> command application and configuration.
>
> The code ought to look like this:
>
>     $this->dispatcher->connect('command.post_command', array($this,
> 'listenToCommandPostCommandEvent'));
>
> ...
>
>     $task = $event->getSubject();
>     if ($task->getFullName() === 'doctrine:data-load')
>     {
>       echo("Running after-fixtures\n");
>       $subtask = new afterFixturesTask($task->getDispatcher(),
> $task->getFormatter());
>       $subtask->setCommandApplication($task->getCommandApplication());
>       $subtask->setConfiguration($task->getConfiguration());
>       $ret = $subtask->run();
>     }
>
> But in actuality the dispatcher, command application and configuration
> are protected and have no getters in sfTask. So even though I am in
> effect subclassing an existing task, I don't have access to the
> properties I need to do that.
>
> My proposal is that public getters be added for these properties so
> that you can take advantage of command.post_command and
> command.pre_command to enhance tasks by triggering others.
>
> --
> Tom Boutell
> P'unk Avenue215 755 1330begin_of_the_skype_highlighting              215 755 
> 1330      end_of_the_skype_highlighting
> punkave.com
> window.punkave.com

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" 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-devs?hl=en

Reply via email to