<?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: Symfony forms &#8211; Flexible widgets based on user credentials (sfcontext is evil)</title>
	<atom:link href="http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/feed/" rel="self" type="application/rss+xml" />
	<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/</link>
	<description>Life, PHP and Symfony - straight from the monkey's mouth</description>
	<lastBuildDate>Wed, 04 Apr 2012 14:42:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Tapper</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-2807</link>
		<dc:creator>Tapper</dc:creator>
		<pubDate>Wed, 04 Apr 2012 14:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-2807</guid>
		<description>Thanks a lot for your article - really helpful!
Had big problems because I forgot to inject the parameter in the &#039;edit&#039; AND &#039;update&#039; action..
:))</description>
		<content:encoded><![CDATA[<p>Thanks a lot for your article &#8211; really helpful!<br />
Had big problems because I forgot to inject the parameter in the &#8216;edit&#8217; AND &#8216;update&#8217; action.. <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FootPrints</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-2031</link>
		<dc:creator>FootPrints</dc:creator>
		<pubDate>Mon, 25 Jul 2011 10:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-2031</guid>
		<description>[...] # Passing values to FOrm classes from action. Symfony [...]</description>
		<content:encoded><![CDATA[<p>[...] # Passing values to FOrm classes from action. Symfony [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xavier</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-1442</link>
		<dc:creator>Xavier</dc:creator>
		<pubDate>Mon, 21 Mar 2011 16:51:21 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-1442</guid>
		<description>Hi,

Thanks for this nice post. I&#039;ll try to refactor my code to include this tip.

xavier.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for this nice post. I&#8217;ll try to refactor my code to include this tip.</p>
<p>xavier.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcelo</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-430</link>
		<dc:creator>Marcelo</dc:creator>
		<pubDate>Thu, 26 Aug 2010 16:51:11 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-430</guid>
		<description>I got it, replaced the first array() by this $var</description>
		<content:encoded><![CDATA[<p>I got it, replaced the first array() by this $var</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcelo</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-429</link>
		<dc:creator>Marcelo</dc:creator>
		<pubDate>Wed, 25 Aug 2010 17:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-429</guid>
		<description>How can I pass a variable through edit action ?
Because it&#039;s already passing an object:
$this-&gt;form = new SoForm($var);</description>
		<content:encoded><![CDATA[<p>How can I pass a variable through edit action ?<br />
Because it&#8217;s already passing an object:<br />
$this-&gt;form = new SoForm($var);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rénald Casagraude</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-414</link>
		<dc:creator>Rénald Casagraude</dc:creator>
		<pubDate>Thu, 03 Jun 2010 14:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-414</guid>
		<description>@Maxime Gréau : you can inject sfUser in admin configuration, eg :

&lt;code&gt;
//action.class.php
  public function preExecute()
  {
    $this-&gt;dispatcher-&gt;connect(&#039;admin.pre_execute&#039;, array($this, &#039;listenToAdminPreExecute&#039;));

    parent::preExecute();
  }

  public function listenToAdminPreExecute(sfEvent $event)
  {
    // Inject sfUser in configuration
    $parameters = $event-&gt;getParameters();

    $parameters[&#039;configuration&#039;]-&gt;setUser($event-&gt;getSubject()-&gt;getUser());
  }
&lt;/code&gt;

Then override getFormOptions() :
&lt;code&gt;
//*GeneratorConfiguration.class.php
  protected $user;

  public function setUser(sfUser $user)
  {
    $this-&gt;user = $user;
  }

  public function getUser()
  {
    return $this-&gt;user;
  }

  public function getFormOptions()
  {
    return array(&#039;user&#039; =&gt; $this-&gt;getUser());
  }
&lt;/code&gt;

See also : http://prendreuncafe.com/blog/post/2010/02/17/User-Dependant-Forms-with-Symfony</description>
		<content:encoded><![CDATA[<p>@Maxime Gréau : you can inject sfUser in admin configuration, eg :</p>
<p><code><br />
//action.class.php<br />
  public function preExecute()<br />
  {<br />
    $this-&gt;dispatcher-&gt;connect('admin.pre_execute', array($this, 'listenToAdminPreExecute'));</p>
<p>    parent::preExecute();<br />
  }</p>
<p>  public function listenToAdminPreExecute(sfEvent $event)<br />
  {<br />
    // Inject sfUser in configuration<br />
    $parameters = $event-&gt;getParameters();</p>
<p>    $parameters['configuration']-&gt;setUser($event-&gt;getSubject()-&gt;getUser());<br />
  }<br />
</code></p>
<p>Then override getFormOptions() :<br />
<code><br />
//*GeneratorConfiguration.class.php<br />
  protected $user;</p>
<p>  public function setUser(sfUser $user)<br />
  {<br />
    $this-&gt;user = $user;<br />
  }</p>
<p>  public function getUser()<br />
  {<br />
    return $this-&gt;user;<br />
  }</p>
<p>  public function getFormOptions()<br />
  {<br />
    return array('user' =&gt; $this-&gt;getUser());<br />
  }<br />
</code></p>
<p>See also : <a href="http://prendreuncafe.com/blog/post/2010/02/17/User-Dependant-Forms-with-Symfony" rel="nofollow">http://prendreuncafe.com/blog/post/2010/02/17/User-Dependant-Forms-with-Symfony</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-370</link>
		<dc:creator>Russ</dc:creator>
		<pubDate>Sat, 13 Mar 2010 11:55:38 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-370</guid>
		<description>@Tonio - Argh not again... Blame Wordpress ;o) I&#039;ll fix... Thanks for the heads up.</description>
		<content:encoded><![CDATA[<p>@Tonio &#8211; Argh not again&#8230; Blame WordPress ;o) I&#8217;ll fix&#8230; Thanks for the heads up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tonio</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-369</link>
		<dc:creator>Tonio</dc:creator>
		<pubDate>Sat, 13 Mar 2010 04:05:31 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-369</guid>
		<description>@Russ : Great explanation, still useful today. You have &gt; breeding in your code snippets, you know... :)</description>
		<content:encoded><![CDATA[<p>@Russ : Great explanation, still useful today. You have &gt; breeding in your code snippets, you know&#8230; <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maxime Gréau</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-366</link>
		<dc:creator>Maxime Gréau</dc:creator>
		<pubDate>Thu, 18 Feb 2010 14:50:51 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-366</guid>
		<description>@Daniel : when you override the getFormOptions() method, how do you to pass the user as an extra option to the form constructor because we don&#039;t have access to the user object (in BaseXXXGeneratorConfiguration) ?</description>
		<content:encoded><![CDATA[<p>@Daniel : when you override the getFormOptions() method, how do you to pass the user as an extra option to the form constructor because we don&#8217;t have access to the user object (in BaseXXXGeneratorConfiguration) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/comment-page-1/#comment-350</link>
		<dc:creator>Russ</dc:creator>
		<pubDate>Tue, 08 Dec 2009 23:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215#comment-350</guid>
		<description>@moh: you should definitely think about throwing an exception in your configure() method if the currentUser option is not fulfilled!</description>
		<content:encoded><![CDATA[<p>@moh: you should definitely think about throwing an exception in your configure() method if the currentUser option is not fulfilled!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

