<?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: Snippet: Symfony User &#8211; Access the User Object</title>
	<atom:link href="http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/feed" rel="self" type="application/rss+xml" />
	<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object</link>
	<description>Web development, Symfony, Wordpress and general geekery</description>
	<lastBuildDate>Thu, 10 May 2012 18:15:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Verine</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-1643</link>
		<dc:creator>Verine</dc:creator>
		<pubDate>Sun, 17 Jul 2011 20:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-1643</guid>
		<description>Thanks a lot. We can&#039;t underestimate the effect that tweaking MySQL variables can have on response times.

Yours, Verine.</description>
		<content:encoded><![CDATA[<p>Thanks a lot. We can&#8217;t underestimate the effect that tweaking MySQL variables can have on response times.</p>
<p>Yours, Verine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ErisDS</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-1529</link>
		<dc:creator>ErisDS</dc:creator>
		<pubDate>Thu, 24 Mar 2011 14:07:48 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-1529</guid>
		<description>It&#039;s the simplest things that are often the hardest to find/figure out!</description>
		<content:encoded><![CDATA[<p>It&#8217;s the simplest things that are often the hardest to find/figure out!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: valentino</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-1520</link>
		<dc:creator>valentino</dc:creator>
		<pubDate>Fri, 18 Mar 2011 16:24:47 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-1520</guid>
		<description>i love you so much! been looking around for so long just for a page like this. Thanks also to pfwd: you saved me a sooo boring googling =)</description>
		<content:encoded><![CDATA[<p>i love you so much! been looking around for so long just for a page like this. Thanks also to pfwd: you saved me a sooo boring googling =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-1445</link>
		<dc:creator>Carlos</dc:creator>
		<pubDate>Mon, 03 Jan 2011 14:47:58 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-1445</guid>
		<description>Thank you very much! Very useful information!</description>
		<content:encoded><![CDATA[<p>Thank you very much! Very useful information!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Closer To The Ideal &#187; Blog Archive &#187; In Symfony, context objects should be given to models via setters</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-506</link>
		<dc:creator>Closer To The Ideal &#187; Blog Archive &#187; In Symfony, context objects should be given to models via setters</dc:creator>
		<pubDate>Thu, 29 Apr 2010 19:39:45 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-506</guid>
		<description>[...] guess I knew this, but it is good to be reminded. Check out the comment by Hugo: Retrieving a factory object (request, response, user, cache…) from the sfContext singleton is [...]</description>
		<content:encoded><![CDATA[<p>[...] guess I knew this, but it is good to be reminded. Check out the comment by Hugo: Retrieving a factory object (request, response, user, cache…) from the sfContext singleton is [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: symfonybr :: Symfony - Snippet - Maneiras de acessar o objeto User</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-413</link>
		<dc:creator>symfonybr :: Symfony - Snippet - Maneiras de acessar o objeto User</dc:creator>
		<pubDate>Tue, 03 Nov 2009 14:18:58 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-413</guid>
		<description>[...] font: http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object [...]</description>
		<content:encoded><![CDATA[<p>[...] font: <a href="http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object">http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arif</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-398</link>
		<dc:creator>Arif</dc:creator>
		<pubDate>Fri, 16 Oct 2009 09:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-398</guid>
		<description>Thanks, it&#039;s really very easy to understand , keep going on</description>
		<content:encoded><![CDATA[<p>Thanks, it&#8217;s really very easy to understand , keep going on</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pfwd</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-311</link>
		<dc:creator>pfwd</dc:creator>
		<pubDate>Sun, 09 Aug 2009 15:12:16 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-311</guid>
		<description>Hi Jimmy,
I couldn&#039;t get the following to work in my action:

&lt;code&gt;$this-&gt;getUser-&gt;getUserId();&lt;/code&gt;

Even tho this worked:

&lt;code&gt;$this-&gt;getUser-&gt;getUsername();&lt;/code&gt;

I did manage to get all the fields (including the id ) by adding getGuardUser() like so:

&lt;code&gt;$this-&gt;getUser()-&gt;getGuardUser()-&gt;getId();&lt;/code&gt;



&lt;code&gt;$this-&gt;getUser()-&gt;getGuardUser()-&gt;getUsername();&lt;/code&gt;



&lt;code&gt;$this-&gt;getUser()-&gt;getGuardUser()-&gt;getCreatedAt();&lt;/code&gt;

This is a link to my source http://forum.symfony-project.org/index.php/m/75314/
Hope that helps</description>
		<content:encoded><![CDATA[<p>Hi Jimmy,<br />
I couldn&#8217;t get the following to work in my action:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;getUser-&gt;getUserId();</div></td></tr></tbody></table></div>
<p>Even tho this worked:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;getUser-&gt;getUsername();</div></td></tr></tbody></table></div>
<p>I did manage to get all the fields (including the id ) by adding getGuardUser() like so:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;getUser()-&gt;getGuardUser()-&gt;getId();</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;getUser()-&gt;getGuardUser()-&gt;getUsername();</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;getUser()-&gt;getGuardUser()-&gt;getCreatedAt();</div></td></tr></tbody></table></div>
<p>This is a link to my source <a href="http://forum.symfony-project.org/index.php/m/75314/">http://forum.symfony-project.org/index.php/m/75314/</a><br />
Hope that helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ErisDS</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-285</link>
		<dc:creator>ErisDS</dc:creator>
		<pubDate>Tue, 28 Jul 2009 21:24:10 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-285</guid>
		<description>Hi Jimmy, 

&lt;kbd&gt;sfContext::getInstance()-&gt;getUser()-&gt;getId(); &lt;/kbd&gt;should work anywhere but the view, but is the ugly way to do it as Hugo explains above.

In an action you can use &lt;kbd&gt;$this-&gt;getUser()-&gt;getId();&lt;/kbd&gt; and in a view it will be &lt;kbd&gt;$sf_user-&gt;getId();&lt;/kbd&gt;

If you can&#039;t get it to work then get in touch with me via my contact form and we&#039;ll take a closer look.</description>
		<content:encoded><![CDATA[<p>Hi Jimmy, </p>
<p><kbd>sfContext::getInstance()->getUser()->getId(); </kbd>should work anywhere but the view, but is the ugly way to do it as Hugo explains above.</p>
<p>In an action you can use <kbd>$this->getUser()->getId();</kbd> and in a view it will be <kbd>$sf_user->getId();</kbd></p>
<p>If you can&#8217;t get it to work then get in touch with me via my contact form and we&#8217;ll take a closer look.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-user-access-the-user-object/comment-page-1#comment-275</link>
		<dc:creator>Jimmy</dc:creator>
		<pubDate>Tue, 28 Jul 2009 14:19:22 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=83#comment-275</guid>
		<description>Do you also now how to get the userID from a view, model, action etc?
I tried sfContext::getInstance()-&gt;getUserId(); and sfContext::getInstance()-&gt;getUser()-&gt;getId();

..?

Cheers, Jim</description>
		<content:encoded><![CDATA[<p>Do you also now how to get the userID from a view, model, action etc?<br />
I tried sfContext::getInstance()-&gt;getUserId(); and sfContext::getInstance()-&gt;getUser()-&gt;getId();</p>
<p>..?</p>
<p>Cheers, Jim</p>
]]></content:encoded>
	</item>
</channel>
</rss>

