<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Run a Symfony Task from your Model or Action</title>
	<atom:link href="http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/feed/" rel="self" type="application/rss+xml" />
	<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/</link>
	<description>Welcome to the Brenternet</description>
	<lastBuildDate>Tue, 07 Jun 2011 16:22:01 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Laurent</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-168</link>
		<dc:creator>Laurent</dc:creator>
		<pubDate>Fri, 24 Sep 2010 14:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-168</guid>
		<description>However, in my case, I wanted to run the task several times, but I noticed that the launch of the second task remembered the first. This has its limits</description>
		<content:encoded><![CDATA[<p>However, in my case, I wanted to run the task several times, but I noticed that the launch of the second task remembered the first. This has its limits</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-167</link>
		<dc:creator>Laurent</dc:creator>
		<pubDate>Thu, 23 Sep 2010 13:23:49 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-167</guid>
		<description>after running task :
$this-&gt;redirect(&#039;/appli.php/...&#039;); // you can pass option in url</description>
		<content:encoded><![CDATA[<p>after running task :<br />
$this-&gt;redirect(&#8217;/appli.php/&#8230;&#8217;); // you can pass option in url</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent Shaffer</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-164</link>
		<dc:creator>Brent Shaffer</dc:creator>
		<pubDate>Sun, 29 Aug 2010 22:26:29 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-164</guid>
		<description>I&#039;ve encountered this too, and I believe it does have to do with the chdir.  In my experience, trying to chdir back to the previous directory does not work.  What I&#039;ve done in this case is split my task into functions I can call individually from where I was previously calling the task.  This will skip the need to chdir altogether.

Please let me know if you find a better solution to this problem.  Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;ve encountered this too, and I believe it does have to do with the chdir.  In my experience, trying to chdir back to the previous directory does not work.  What I&#8217;ve done in this case is split my task into functions I can call individually from where I was previously calling the task.  This will skip the need to chdir altogether.</p>
<p>Please let me know if you find a better solution to this problem.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prasad</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-163</link>
		<dc:creator>Prasad</dc:creator>
		<pubDate>Sat, 28 Aug 2010 17:50:24 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-163</guid>
		<description>Hey, thanks a ton for this !!

But the problem I&#039;m facing that my action cannot find the template it requires. Is that because of the chdir?
Error: The template &quot;onboardSuccess.php&quot; does not exist or is unreadable in &quot;&quot;.

Appreciate any help</description>
		<content:encoded><![CDATA[<p>Hey, thanks a ton for this !!</p>
<p>But the problem I&#8217;m facing that my action cannot find the template it requires. Is that because of the chdir?<br />
Error: The template &#8220;onboardSuccess.php&#8221; does not exist or is unreadable in &#8220;&#8221;.</p>
<p>Appreciate any help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis Gearon</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-136</link>
		<dc:creator>Dennis Gearon</dc:creator>
		<pubDate>Fri, 16 Jul 2010 06:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-136</guid>
		<description>found out one thing that this approach WON&#039;T do . . drop and recreate the database repetatively for testing with PHPUnit. Apparently, those actions are not transactionalble, or act like it with Postgres/Symfony/Apache/PHPUnit. See my blog post to learn &#039;easier that I had to&#039; how to get around that issue. 

http://php-rest-i18n.blogspot.com/2010/07/testing-symfony-apps-with-phpunit.html
I DID use the method above for reloading the fixture files, and it worked great.</description>
		<content:encoded><![CDATA[<p>found out one thing that this approach WON&#8217;T do . . drop and recreate the database repetatively for testing with PHPUnit. Apparently, those actions are not transactionalble, or act like it with Postgres/Symfony/Apache/PHPUnit. See my blog post to learn &#8216;easier that I had to&#8217; how to get around that issue. </p>
<p><a href="http://php-rest-i18n.blogspot.com/2010/07/testing-symfony-apps-with-phpunit.html" rel="nofollow">http://php-rest-i18n.blogspot.com/2010/07/testing-symfony-apps-with-phpunit.html</a><br />
I DID use the method above for reloading the fixture files, and it worked great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis Gearon</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-135</link>
		<dc:creator>Dennis Gearon</dc:creator>
		<pubDate>Tue, 13 Jul 2010 06:33:23 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-135</guid>
		<description>Great! Thanks for the help. I&#039;ll be able to use my super duper task now, from a test harness. Oh boy, (deep sigh), getting closer to understanding the Symfony framework and now they&#039;re going to change it!!! Oh well, it&#039;ll have some similar features.</description>
		<content:encoded><![CDATA[<p>Great! Thanks for the help. I&#8217;ll be able to use my super duper task now, from a test harness. Oh boy, (deep sigh), getting closer to understanding the Symfony framework and now they&#8217;re going to change it!!! Oh well, it&#8217;ll have some similar features.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent Shaffer</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-116</link>
		<dc:creator>Brent Shaffer</dc:creator>
		<pubDate>Thu, 29 Apr 2010 16:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-116</guid>
		<description>In your test bootstraps (unit or functional), you should be retrieving an instance of ProjectConfiguration:


&lt;blockquote&gt;
// Functional Tests
$configuration = ProjectConfiguration::getApplicationConfiguration($app, &#039;test&#039;, isset($debug) ? $debug : true);

//Unit Tests:
$configuration = ProjectConfiguration::hasActive() ? ProjectConfiguration::getActive() : new ProjectConfiguration(realpath($_test_dir . &#039;/..&#039;));
&lt;/blockquote&gt;

You can then use this to create and run your task:


&lt;blockquote&gt;
$task = new sfFooTask($configuration-&gt;getEventDispatcher(), new sfFormatter());
$task-&gt;run($argumentsArray, $optionsArray));
&lt;/blockquote&gt;

I hope this helps!</description>
		<content:encoded><![CDATA[<p>In your test bootstraps (unit or functional), you should be retrieving an instance of ProjectConfiguration:</p>
<blockquote><p>
// Functional Tests<br />
$configuration = ProjectConfiguration::getApplicationConfiguration($app, &#8216;test&#8217;, isset($debug) ? $debug : true);</p>
<p>//Unit Tests:<br />
$configuration = ProjectConfiguration::hasActive() ? ProjectConfiguration::getActive() : new ProjectConfiguration(realpath($_test_dir . &#8216;/..&#8217;));
</p></blockquote>
<p>You can then use this to create and run your task:</p>
<blockquote><p>
$task = new sfFooTask($configuration-&gt;getEventDispatcher(), new sfFormatter());<br />
$task-&gt;run($argumentsArray, $optionsArray));
</p></blockquote>
<p>I hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: valter779</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-115</link>
		<dc:creator>valter779</dc:creator>
		<pubDate>Wed, 14 Apr 2010 06:55:25 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-115</guid>
		<description>is there a way to run task from unit/functional test ?</description>
		<content:encoded><![CDATA[<p>is there a way to run task from unit/functional test ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/comment-page-1/#comment-91</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Tue, 23 Feb 2010 20:08:54 +0000</pubDate>
		<guid isPermaLink="false">http://brentertainment.com/?p=243#comment-91</guid>
		<description>expect that with sfContext::getInstance() you kill kittens. Please use $this-&gt;getContext() within an action (and do not call a task from the model !)</description>
		<content:encoded><![CDATA[<p>expect that with sfContext::getInstance() you kill kittens. Please use $this-&gt;getContext() within an action (and do not call a task from the model !)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

