<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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>Symfony Notes</title>
	<atom:link href="http://symfonynotes.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://symfonynotes.com</link>
	<description></description>
	<pubDate>Sat, 05 Dec 2009 02:34:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hosting symfony based website with nginx</title>
		<link>http://symfonynotes.com/2009/12/04/hosting-symfony-based-website-with-nginx/</link>
		<comments>http://symfonynotes.com/2009/12/04/hosting-symfony-based-website-with-nginx/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:32:01 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[Hosting]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/?p=43</guid>
		<description><![CDATA[The following config file allows you to host symfony based website with Nginx  web server. 


server {
	listen   80;
	server_name  www.your-url.com;

               #Enable Gzip
	gzip on;
	gzip_min_length 1000;
	gzip_types text/plain application/xml;
	gzip_disable "MSIE [1-6]\.";

           [...]]]></description>
			<content:encoded><![CDATA[<p>The following config file allows you to host symfony based website with <a href="http://wiki.nginx.org/Main">Nginx </a> web server. </p>
<pre class="php">

server {
	listen   80;
	server_name  www.your-url.com;

               #Enable Gzip
	gzip on;
	gzip_min_length 1000;
	gzip_types text/plain application/xml;
	gzip_disable "MSIE [1-6]\.";

              #where to put log files
	access_log  /var/log/nginx/your-url.com.access.log;

              #project's main directory
	root /full/path/web/;

              #change the following to index.php on production server.
	index front_dev.php;

	charset utf-8;

	location /sf {
                  #path to folder where all symfony assets are located
	    alias /full/path/lib/symfony/data/web/sf;
	}

	location / {
	    # If the file exists as a static file serve it directly without
	    # running al	l the other rewite tests on it
	    if (-f $request_filename) {
		expires 1m;
		break;
	      }

	    if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") {
                            #change front_dev to index.php on production server
		rewrite ^(.*) /front_dev.php$1 last;
		  }
	}

	location ~ "^(.+\.php)($|/)" {

	    set $script $uri;
	    set $path_info "/";

	    if ($uri ~ "^(.+\.php)($|/)") {
		set $script $1;
	      }

	    if ($uri ~ "^(.+\.php)(/.+)") {
		set $script $1;
		set $path_info $2;
	      }

	  include /etc/nginx/fastcgi_params;
	  fastcgi_pass 127.0.0.1:9000;

	  fastcgi_param SCRIPT_FILENAME /full/path/web$script;
	  fastcgi_param SCRIPT_NAME $script;
	  fastcgi_param PATH_INFO $path_info;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/12/04/hosting-symfony-based-website-with-nginx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessing sfGuardPlugin user id.</title>
		<link>http://symfonynotes.com/2009/09/29/accessing-sfguardplugin-user-id/</link>
		<comments>http://symfonynotes.com/2009/09/29/accessing-sfguardplugin-user-id/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:08:20 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[Actions]]></category>

		<category><![CDATA[Plugins]]></category>

		<category><![CDATA[View]]></category>

		<category><![CDATA[sfGuardPlugin]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/?p=37</guid>
		<description><![CDATA[If you are using sfGuardPlugin all you need to get id of a user that is currently logged in is this:
In  your actions.class.php

$user_id = $this-&#62;getUser&#40;&#41;-&#62;getGuardUser&#40;&#41;-&#62;getId&#40;&#41;;

But this will cause fatal error if the user is not authenticated. We can prevent this with isAuthenticated().
// /apps/frontend/lib/myUser.class.php

class myUser extends sfGuardSecurityUser
&#123;
     public function getUserId&#40;&#41;
  [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using sfGuardPlugin all you need to get id of a user that is currently logged in is this:</p>
<p>In  your actions.class.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$user_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGuardUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>But this will cause fatal error if the user is not authenticated. We can prevent this with isAuthenticated().<br />
// /apps/frontend/lib/myUser.class.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> myUser <span style="color: #000000; font-weight: bold;">extends</span> sfGuardSecurityUser
<span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getUserId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAuthenticated</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGuardUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">else</span>
           <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/09/29/accessing-sfguardplugin-user-id/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Memcached with Symfony 1.2 and Doctrine</title>
		<link>http://symfonynotes.com/2009/09/15/using-memcached-with-symfony-12-and-doctrine/</link>
		<comments>http://symfonynotes.com/2009/09/15/using-memcached-with-symfony-12-and-doctrine/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 15:39:33 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[Actions]]></category>

		<category><![CDATA[doctrine]]></category>

		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/2009/09/15/using-memcached-with-symfony-12-and-doctrine/</guid>
		<description><![CDATA[Make sure you have Memcached installed.
Add this to ProjectConfiguration.class.php

//ProjectConfiguration.class.php
    public function configureDoctrine&#40;Doctrine_Manager $manager&#41; &#123;
&#160;
        $servers = array&#40;
            'host' =&#62; 'localhost',
            'port' =&#62; 11211,
 [...]]]></description>
			<content:encoded><![CDATA[<p>Make sure you have Memcached installed.</p>
<p>Add this to ProjectConfiguration.class.php</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//ProjectConfiguration.class.php</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configureDoctrine<span style="color: #009900;">&#40;</span>Doctrine_Manager <span style="color: #000088;">$manager</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$servers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'port'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">11211</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'persistent'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">true</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        <span style="color: #000088;">$cacheDriver</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Doctrine_Cache_Memcache<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'servers'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$servers</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'compression'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span>
            <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//enable Doctrine cache</span>
        <span style="color: #000088;">$manager</span> <span style="color: #339933;">=</span> Doctrine_Manager<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
        <span style="color: #000088;">$manager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribute</span><span style="color: #009900;">&#40;</span>Doctrine<span style="color: #339933;">::</span><span style="color: #004000;">ATTR_RESULT_CACHE</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cacheDriver</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Add this to your query</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #339933;">-&gt;</span><span style="color: #004000;">useResultCache</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/09/15/using-memcached-with-symfony-12-and-doctrine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessing sfUser from template</title>
		<link>http://symfonynotes.com/2009/02/03/accessing-sfuser-from-template/</link>
		<comments>http://symfonynotes.com/2009/02/03/accessing-sfuser-from-template/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 00:41:50 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[View]]></category>

		<category><![CDATA[$sf_user]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/?p=19</guid>
		<description><![CDATA[It&#8217;s very easy - just use the $sf_user variable
Example.:

&#60;?php if&#40;$sf_user-&#62;isAuthenticated&#40;&#41;&#41;:? &#62;
     &#60; ?php echo &#34;User is authenticated&#34;?&#62;
&#60;?php else:?&#62;
     &#60;?php echo &#34;User is not authenticated&#34;?&#62;
&#60;?php endif?&#62;

]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy - just use the $sf_user variable</p>
<p>Example.:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sf_user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAuthenticated</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>? <span style="color: #339933;">&gt;</span>
     <span style="color: #339933;">&lt;</span> ?php <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;User is authenticated&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;User is not authenticated&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/02/03/accessing-sfuser-from-template/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating thumbnails with sfThumbnailPlugin and doctrine</title>
		<link>http://symfonynotes.com/2009/02/03/creating-thumbnails-with-sfthumbnailplugin-and-doctrine/</link>
		<comments>http://symfonynotes.com/2009/02/03/creating-thumbnails-with-sfthumbnailplugin-and-doctrine/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:29:26 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[Model]]></category>

		<category><![CDATA[doctrine]]></category>

		<category><![CDATA[sfThumbnailPlugin]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/?p=6</guid>
		<description><![CDATA[
&#160;
public function set&#40;$name, $value, $load = true&#41;
&#123;
            parent::set&#40;$name, $value, $load&#41;;
            if&#40;$name == 'file'&#41;
                $this-&#62;generateThumbnail&#40;$value&#41;;
     [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> set<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #000088;">$load</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
            parent<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #000088;">$load</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generateThumbnail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> generateThumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$uploadDir</span> <span style="color: #339933;">=</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_upload_dir'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$loadDir</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$uploadDir</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$thumbnail</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfThumbnail<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$thumbnail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$loadDir</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$thumbnail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uploadDir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/thumbs/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'image/jpeg'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/02/03/creating-thumbnails-with-sfthumbnailplugin-and-doctrine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://symfonynotes.com/2009/02/03/hello-world/</link>
		<comments>http://symfonynotes.com/2009/02/03/hello-world/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 18:35:41 +0000</pubDate>
		<dc:creator>Mariusz</dc:creator>
		
		<category><![CDATA[View]]></category>

		<guid isPermaLink="false">http://symfonynotes.com/?p=1</guid>
		<description><![CDATA[
&#160;
&#60;?php echo 'Hello World!'?&#62;

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'Hello World!'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://symfonynotes.com/2009/02/03/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
