<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Magento Design and Development &#187; Zend</title>
	<atom:link href="http://inchoo.net/category/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Fri, 10 Sep 2010 10:39:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>We are hiring!</title>
		<link>http://inchoo.net/ecommerce/magento/we-are-hiring-osijek-croatia/</link>
		<comments>http://inchoo.net/ecommerce/magento/we-are-hiring-osijek-croatia/#comments</comments>
		<pubDate>Fri, 07 May 2010 23:00:02 +0000</pubDate>
		<dc:creator>Tomislav Bilic</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[iPhone dev]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=2992</guid>
		<description><![CDATA[Do you know what the word above means? If you do, than you might be one of the candidates for a job position in our company. As some of you who are visiting the site for a longer time know, Inchoo was founded in May 2008. At the time of inception, Branko and me were [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know what the word above means? If you do, than you might be one of the candidates for a job position in our company. As some of you who are visiting the site for a longer time know, Inchoo was founded in May 2008. At the time of inception, <a href="/author/branko/">Branko</a> and me were the team at the start. Today, our team counts 16 members. <strong>Are you interested to join?</strong></p>
<p><span id="more-2992"></span>We are looking for individuals for following positions:</p>
<ol>
<li><strong>Magento/ZEND developer</strong> is a hard core programmer. You need to have great PHP/ZEND knowledge and good English skills. You need to have at least 2 years of web programming experience and a few projects behind you can show. You don&#8217;t need to know Magento for this position, but you should have ZEND knowledge or at least know some PHP framework. You&#8217;ll learn Magento in time.</li>
<li><strong>Mobile Apps Developer</strong> needs to be an experienced programmer ready to learn new languages. iPhone SDK will be the first one since <a href="http://www.surgeworksmobile.com/">our team</a> has the most demand for <a href="http://surgeworksmobile.com/services/iphone-app-development">iPhone</a> and <a href="http://surgeworksmobile.com/services/ipad-app-development">iPad applications</a>. You also need to speak English. If you also have project management experience, be sure to mention this. We like the people who have project management skills. You will learn in time how to use Mac and develop for iPhone and iPad.</li>
</ol>
<p>Now, the tricky part for some of you who are reading this is: the position is in our office in <a title="Contact Inchoo in Osijek, Croatia" href="/contact/">Osijek, Croatia</a>. If you are from our town, don&#8217;t hesitate to contact us. If you are not, don&#8217;t be discouraged. We might soften the policy to hire a local resource. In either case, send us your resume and portfolio to this address and we&#8217;ll get in touch with you. <img src="http://inchoo.net/wp-content/themes/newinchoo/images/webinchoo.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/we-are-hiring-osijek-croatia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Controller Plugin in Zend Framework</title>
		<link>http://inchoo.net/zend/simple-controller-plugin-in-zend-framework/</link>
		<comments>http://inchoo.net/zend/simple-controller-plugin-in-zend-framework/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 12:45:50 +0000</pubDate>
		<dc:creator>Vedran Subotic</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=3900</guid>
		<description><![CDATA[This tutorial will describe how to create own Controller Plugin. How to set up environment for zend framework controller plugin. How extend the library with own class and finally how to use it. Plugin is nothing else but the class, in our case it extends Zend_Controller_Plugin_Abstract. First of all you need name for your plugin, [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will describe how to create own Controller Plugin.<br />
How to set up environment for zend framework controller plugin.<br />
How extend the library with own class and finally how to use it.<br />
<span id="more-3900"></span><br />
Plugin is nothing else but the class, in our case it extends Zend_Controller_Plugin_Abstract.<br />
First of all you need name for your plugin, why?<br />
Because we need to set up enviroment for plugin usage and we start with the name.</p>
<p>I called my plugin “Example_Controller_Plugin_Param”, it means that I have created file (class) called “Param.php”<br />
in “library/ Example/Controller/Plugin/”.<br />
Then in “application/Bootstrap.php” class I created method “_initAutoload” in which we need to register nampspace.</p>
<pre class="brush: php">
&lt; ?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	protected function _initAutoload()
    {
    	/*
    	 * If you don&#039;t register namespace
    	 * You will get error :
    	 * Fatal error: Class &#039;Example_Controller_Plugin_Param&#039; not found in
    	 * ...\library\Zend\Application\Resource\Frontcontroller.php on line 92
    	 *
    	 */

    	$autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader-&gt;registerNamespace(&#039;Example_&#039;);
        $autoloader-&gt;suppressNotFoundWarnings(true);

        /*
         * also you will get Exception :
         * No entry is registered for key &#039;Zend_Request_Example&#039;
         * called in helper ParamHelper.php
         *
         */

    }

}
</pre>
<p>Also in “application/configs/application.ini” file we need to prepare plugin ready for usage with line:<br />
resources.frontController.plugins.param = &#8220;Example_Controller_Plugin_Param&#8221;</p>
<p>When you do this steps, check your application if you got some errors or warnings before you go to coding.<br />
Now when we set up environment, we can start with coding our plugin.</p>
<p>I tried to simplyfie this example so our plugin will only create new custom request parameter,<br />
which will appear when you debug</p>
<pre class="brush: php">Zend_Debug::dump($this-&gt;_request-&gt;getParams()); </pre>
<p>in any Controller class.<br />
And it will start the session, create session namespaces with simple logic which will check if the session params are set or not and it will throw an Exception.</p>
<pre class="brush: php">
&lt; ?php
class Example_Controller_Plugin_Param extends Zend_Controller_Plugin_Abstract
{
	protected $_param;

	private $_userID;

	public function routeShutdown(Zend_Controller_Request_Abstract $request)
	{
		/*
		 * we start session here
		 * so we do not need to start it in each action, controller or module
		 */
		Zend_Session::start();

		/*
		 * we create session with namespace &#039;login&#039;
		 */
    	$namespace = new Zend_Session_Namespace(&#039;login&#039;); 

    	/*
    	 *
    	 */
    	$this-&gt;_userID = $namespace-&gt;user; 

			/*
			 * create some simple logic, just to see application behaviour
			 */

    		if (!isset($this-&gt;_userID) or $this-&gt;_request-&gt;getParam(&quot;user&quot;) != null) {
				$this-&gt;_userID = $this-&gt;_request-&gt;getParam(&quot;user&quot;, null);

				if ($this-&gt;_userID == null) {
					throw new Exception(&quot;user id not found&quot;);
				}

				$namespace-&gt;user = $this-&gt;_userID;
			}

		/*
		 * Just for example we also create new custom request parameter
		 *  with name and value, cannot set this in helper
		 *
		 */
		$this-&gt;_param = $this-&gt;_request-&gt;setParam(&#039;param&#039;, &#039;custom&#039;);

		Zend_Registry::set(&#039;Zend_Request_Example&#039;, $this-&gt;_param-&gt;param);

	}

}
</pre>
<p><a href="http://inchoo.net/wp-content/uploads/2010/01/plugin_exception.png" rel="lightbox[3900]"><img src="http://inchoo.net/wp-content/uploads/2010/01/plugin_exception.png" alt="" title="plugin_exception" width="620" height="334" class="aligncenter size-full wp-image-3909" /></a><br />
<a href="http://inchoo.net/wp-content/uploads/2010/01/plugin_user.png" rel="lightbox[3900]"><img src="http://inchoo.net/wp-content/uploads/2010/01/plugin_user.png" alt="" title="plugin_user" width="620" height="431" class="aligncenter size-full wp-image-3910" /></a></p>
<p>What is so special here?<br />
Well, in this example you do not need to create session namespaces in any action, controller or module and this is something what spares our development time and lines of code.</p>
<p>Source code link: <a href='http://inchoo.net/wp-content/uploads/2010/01/zf.plugin.example.zip'>zf.plugin.example</a><br />
Test your new plugin and enjoy in coding with Zend Framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/simple-controller-plugin-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework Custom View Helper</title>
		<link>http://inchoo.net/zend/zend-framework-custom-view-helper/</link>
		<comments>http://inchoo.net/zend/zend-framework-custom-view-helper/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 08:50:20 +0000</pubDate>
		<dc:creator>Vedran Subotic</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=2960</guid>
		<description><![CDATA[Creating custom helper in new Zend Framework edition 1.9 in few easy steps. Let&#8217;s assume that we need to fetch some data from database but we do not need them in all view files. We need to insert this line in application/config.ini to register path to helpers: application/configs/application.ini resources.view.helperPath = APPLICATION_PATH &#8220;/views/helpers&#8221; First create model [...]]]></description>
			<content:encoded><![CDATA[<p>Creating custom helper in new Zend Framework edition 1.9 in few easy steps.<br />
Let&#8217;s assume that we need to fetch some data from database<br />
but we do not need them in all view files.<br />
<span id="more-2960"></span></p>
<p>We need to insert this line in <strong>application/config.ini</strong> to register path to helpers:</p>
<p><strong>application/configs/application.ini</strong><br />
resources.view.helperPath = APPLICATION_PATH &#8220;/views/helpers&#8221;</p>
<p>First create model which will give you an array,<br />
in my example it&#8217;s list of states, which you will call in you helper file:</p>
<p><strong>application/models/DbTable/States.php</strong></p>
<pre class="brush: php">
class Model_DbTable_States extends Zend_Db_Table_Abstract
{
    protected $_name = &#039;state_list&#039;;

    public function getStates()
    {

        $row = $this-&gt;fetchAll();
        if (!$row) {
            throw new Exception(&quot;No States&quot;);
        }

        $row = $row-&gt;toArray();

        return $row;
    }
}
</pre>
<p>Class needs to begegins with “Zend_View_Helper_”<br />
That is why it is “view helper”  and it cannot be called in controller or model files,<br />
if you do that you will get error that “method deoesn&#8217;t exists”.</p>
<p><strong>application/view/helpers/State.php</strong></p>
<pre class="brush: php">
class Zend_View_Helper_State
{
	protected $_list;

	public function state()
    {
    	$state = new Model_DbTable_States();
	return $this-&gt;_list-&gt;getStates();

    }
}
</pre>
<p>After that and make a list of states in:</p>
<p><strong>application/layouts/sidebar.phtml</strong></p>
<pre class="brush: php">
&lt;ul&gt;
	&lt; ?php foreach ($this-&gt;state() as $item):?&gt;

		&lt;li&gt;&lt; ?php echo $item[&#039;state&#039;]?&gt;&lt;/li&gt;

	&lt; ?php endforeach;?&gt;
&lt;/ul&gt;
</pre>
<p>and call  it in main layout file:</p>
<p><strong>application/layouts/layout.phtml</strong></p>
<pre class="brush: php">
&lt; ?php
echo $this-&gt;partial(&#039;sidebar.phtml&#039;);
?&gt;
</pre>
<p>In this case you will get content from your helper file in all views which will render main layout file from <strong>application/layouts/layout.phtml</strong>.<br />
However, if you wish to call your helper in particular view all you need to do is to call the helper in view file:</p>
<pre class="brush: php">
&lt; ?php
$this-&gt;state();
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/zend-framework-custom-view-helper/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Zend framework notification system</title>
		<link>http://inchoo.net/zend/zend-framework-notification-system/</link>
		<comments>http://inchoo.net/zend/zend-framework-notification-system/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 13:03:00 +0000</pubDate>
		<dc:creator>Vedran Subotic</dc:creator>
				<category><![CDATA[Zend]]></category>
		<category><![CDATA[notification]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=2552</guid>
		<description><![CDATA[I was playing around with admin interface for one custom project and I wanted general notification system for updating, adding, deleting records in database or any other action I could imagine. Zend framework has built in notification system where you can easily call the following helper (it&#8217;s an controller action helper). I hope this code [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with admin interface for one custom project and I wanted general notification system for updating, adding, deleting records in database or any other action I could imagine. Zend framework has built in notification system where you can easily call the following helper (it&#8217;s an controller action helper). I hope this code will help somebody.</p>
<p><span id="more-2552"></span></p>
<pre class="brush: php">
$this-&gt;_helper-&gt;flashMessenger();
</pre>
<p>First you need to register your view variable in init() method if you want to have notifications in all view files of your controller.</p>
<pre class="brush: php">
public function init()
{

/* Initialize action controller here*/
$this-&gt;view-&gt;messages = $this-&gt;_helper-&gt;flashMessenger-&gt;getMessages();

}
</pre>
<p>Then you simply add messages in your action methods like this:</p>
<pre class="brush: php">
$this-&gt;_helper-&gt;flashMessenger-&gt;addMessage(array(&quot;ok_message&quot; =&gt; &#039;record deleted&#039;));
or
$this-&gt;_helper-&gt;flashMessenger-&gt;addMessage(array(&quot;err_message&quot; =&gt; &#039;unable to comply&#039;));
</pre>
<p>Why wasting you code when you got all in one place, right?</p>
<p>Once you register the message notification all you need is to choose where message should appear.That&#8217;s the easy part, just need to style your div ids and classes in view files.</p>
<pre class="brush: php">
&lt; ?php if(isset($this-&gt;messages)):?&gt;
&lt;div class=&quot;grid_12&quot;&gt;
&lt; ?php foreach($this-&gt;messages as $message):?&gt;
&lt;div id=&quot;site_info&quot;&gt;
&lt;div class=&quot;box&quot;&gt;
&lt; ?php if(isset($message[&quot;error&quot;])):?&gt;
&lt;p&gt;&lt; ?php echo $message[&quot;error&quot;]?&gt;&lt;/p&gt;
&lt; ?php elseif(isset($message[&quot;ok&quot;])):?&gt;
&lt;p&gt;&lt; ?php echo $message[&quot;ok&quot;]?&gt;&lt;/p&gt;
&lt; ?php endif?&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt; ?php endforeach?&gt;
&lt;/div&gt;
&lt; ?php endif?&gt;
</pre>
<p>One trick, if you want to show them on all view pages, edit your layout file and paste the code above at header,footer or wherever you want them to be shown<br />
(there is no need to put them in you view files, unless you want to show same notifications twice <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).</p>
<p>The easiest way to have notifications in other modules is to register it like session variable  and unset them manually.</p>
<p>Check class Zend_Controller_Action_Helper_FlashMessenger for additional purposes.<br />
Enjoy coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/zend-framework-notification-system/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using partial helpers in Zend Framework</title>
		<link>http://inchoo.net/zend/using-partial-helpers-in-zend-framework/</link>
		<comments>http://inchoo.net/zend/using-partial-helpers-in-zend-framework/#comments</comments>
		<pubDate>Mon, 25 May 2009 14:19:03 +0000</pubDate>
		<dc:creator>Vedran Subotic</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=1972</guid>
		<description><![CDATA[ZendFrameworkQuickstart application is demo guestbook with Zend library files included, basic folder structure and some sample data for fetching and entering new. It is already configured for usage and always updated with the latest release of Zend Framework. The quickest way to setup Zend FrameworkQuickstart app for you is next 2 steps: 1.you need to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://framework.zend.com/docs/quickstart">ZendFrameworkQuickstart application</a> is demo guestbook with Zend  library files included,<br />
basic folder structure and some sample data for fetching and entering new.<br />
It is already configured for usage and always updated with the latest release of Zend Framework.<br />
<span id="more-1972"></span><br />
The quickest way to setup Zend FrameworkQuickstart app for you is next 2 steps:<br />
1.you need to download  <a href="http://framework.zend.com/demos/ZendFrameworkQuickstart-20090430.zip">ZendFrameworkQuickstart application files</a><br />
2.and setup virtual host pointing to public folder  (e.g. /var/www/zend.quickstart/public/)</p>
<p>I used <a href="http://framework.zend.com/docs/quickstart">ZendFrameworkQuickstart application</a>  for you so you can easier test the code I provided.<br />
You just need to download  and setup latest <a href="http://framework.zend.com/demos/ZendFrameworkQuickstart-20090430.zip">ZendFrameworkQuickstart</a> and replace default files  with files I posted.<br />
Here is the post:</p>
<p>In layout file (our case &#8220;layout.phtml&#8221; in application/layouts/scripts/)<br />
we just need to call helper $this->partial and correct path to partial file</p>
<pre class="brush: php">
&lt;div id=&quot;categories&quot;&gt;
    &lt; ?php echo $this-&gt;partial(&#039;partials/categories.phtml&#039;,
				            array(&#039;categories&#039; =&gt; $this-&gt;data)); ?&gt;
&lt;/div&gt;
</pre>
<p>with correct &#8220;keys&#8221; and &#8220;values&#8221; (our case &#8216;categories&#8217; and $this->data).<br />
Key (&#8216;categories&#8217;) will stand for entity which is iterrated in our partial file in foreach loop<br />
(our case &#8220;categories.phtml&#8221; in application/layouts/scripts/partials)</p>
<pre class="brush: php">
&lt;ul&gt;
&lt; ?php foreach($this-&gt;categories as $item) : ?&gt;
	&lt;li class=&quot;item&quot;&gt;
	  &lt;a href=&quot;&lt;?php echo $this-&gt;url(
	  					array(
							&quot;cat&quot;=&gt;$item[&#039;key&#039;],
                                                        &quot;action&quot;=&gt;&quot;index&quot;,
	  						&quot;controller&quot;=&gt;&quot;index&quot;,
	  						&quot;module&quot;=&gt;&quot;default&quot;
	  										))?&gt;&quot;&gt;
		&lt; ?php echo $item[&#039;value&#039;]; ?&gt;&lt;/a&gt;
    	&lt;/li&gt;
&lt; ?php endforeach; ?&gt;
&lt;/ul&gt;
</pre>
<p>and value ($this->data) must be defined in our controller class file as a view helper ($this->view->data),<br />
I defined it in init() method so it will be set for all actions in IndexController.</p>
<pre class="brush: php">
public function init()
	{
		$this-&gt;view-&gt;data =
				array(
					array(&#039;key&#039; =&gt; &#039;key_1&#039;, &#039;value&#039; =&gt; &#039;category_1&#039;),
					array(&#039;key&#039; =&gt; &#039;key_2&#039;, &#039;value&#039; =&gt; &#039;category_2&#039;),
					array(&#039;key&#039; =&gt; &#039;key_3&#039;, &#039;value&#039; =&gt; &#039;category_3&#039;),
					array(&#039;key&#039; =&gt; &#039;key_4&#039;, &#039;value&#039; =&gt; &#039;category_4&#039;),
				);
	}
</pre>
<p>I added demoAction so you can try to set different data set or you can try to play with the code and create some data set from query result.<br />
Enjoy.</p>
<p>Link to <a href="http://inchoo.net/wp-content/uploads/files/application.rar">code files</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/using-partial-helpers-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Doctrine ORM and Zend Framework, sample project to get you started (with sample database)</title>
		<link>http://inchoo.net/zend/doctrine-orm-and-zend-framework-sample-project-to-get-you-started/</link>
		<comments>http://inchoo.net/zend/doctrine-orm-and-zend-framework-sample-project-to-get-you-started/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 09:34:25 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Zend]]></category>
		<category><![CDATA[Doctrine ORM]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=1476</guid>
		<description><![CDATA[I&#8217;ve created a sample project for those of you interested in working with Doctrine ORM and Zend Framework (my favorite toys in last few weeks). All you need to get it up n running is a download of Doctrine ORM and Zend Framework. Project is set for auto loading both Zend and Doctrine Frameworks so [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a sample project for those of you interested in working with Doctrine ORM and Zend Framework (my favorite toys in last few weeks). All you need to get it up n running is a download of <a href="http://www.doctrine-project.org/download">Doctrine ORM</a> and <a href="http://framework.zend.com/download">Zend Framework</a>.<span id="more-1476"></span></p>
<p>Project is set for auto loading both Zend and Doctrine Frameworks so all you need to do is to instantiate <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  -Also, below you can see few screenshots of the sample code I implemented. Also, I provide you with the .sql dump (doctrinesql) file that goes with this project. Note the use of InnoDB engine in database. Since Doctrine comes with this cool hasOne, hasMany relation mappings, you can use bunch of cool stuff to easily do various actions on database once you get familiar with Doctrine. Although MyISAM engine is somewhat faster than InnoDB, without second thoughts I choose InnoDB due to foreign keys features.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/example_user_entry.png" rel="lightbox[1476]"><img class="alignnone size-medium wp-image-1479" title="example_user_entry" src="http://inchoo.net/wp-content/uploads/2009/04/example_user_entry-637x457.png" alt="example_user_entry" width="637" height="457" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/bootstrap_setup.png" rel="lightbox[1476]"><img class="alignnone size-medium wp-image-1480" title="bootstrap_setup" src="http://inchoo.net/wp-content/uploads/2009/04/bootstrap_setup-637x338.png" alt="bootstrap_setup" width="637" height="338" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/user_class_autogenerated.png" rel="lightbox[1476]"><img class="alignnone size-medium wp-image-1481" title="user_class_autogenerated" src="http://inchoo.net/wp-content/uploads/2009/04/user_class_autogenerated-637x190.png" alt="user_class_autogenerated" width="637" height="190" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/article_class_autogenerated.png" rel="lightbox[1476]"><img class="alignnone size-medium wp-image-1482" title="article_class_autogenerated" src="http://inchoo.net/wp-content/uploads/2009/04/article_class_autogenerated-637x190.png" alt="article_class_autogenerated" width="637" height="190" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/create_new_user.png" rel="lightbox[1476]"><img class="alignnone size-full wp-image-1483" title="create_new_user" src="http://inchoo.net/wp-content/uploads/2009/04/create_new_user.png" alt="create_new_user" width="518" height="265" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/add_new_user_and_new_article.png" rel="lightbox[1476]"><img class="alignnone size-full wp-image-1484" title="add_new_user_and_new_article" src="http://inchoo.net/wp-content/uploads/2009/04/add_new_user_and_new_article.png" alt="add_new_user_and_new_article" width="595" height="333" /></a></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/04/add_article_for_existing_user.png" rel="lightbox[1476]"><img class="alignnone size-full wp-image-1485" title="add_article_for_existing_user" src="http://inchoo.net/wp-content/uploads/2009/04/add_article_for_existing_user.png" alt="add_article_for_existing_user" width="566" height="118" /></a></p>
<p>Download project files:<br />
<a href="http://inchoo.net/wp-content/uploads/2009/04/doctrinesql.zip">doctrinesql</a><br />
<a href="http://inchoo.net/wp-content/uploads/2009/04/doctrine_example_project.zip">doctrine_example_project (doctrine orm and zend framework)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/doctrine-orm-and-zend-framework-sample-project-to-get-you-started/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Zend_Auth Database Table Authentification</title>
		<link>http://inchoo.net/zend/zend_auth-database-table-authentification/</link>
		<comments>http://inchoo.net/zend/zend_auth-database-table-authentification/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 18:37:58 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=1122</guid>
		<description><![CDATA[Zend Framework comes with interesting and useful components when it comes to authentication and authorization of users. Zend_Auth is one such component whose task is to handle authentication. I made a little screencast on topic of Zend_Auth database table authentication. Screencast is video only, plus some visual pointers, no audio. Hope some of you find [...]]]></description>
			<content:encoded><![CDATA[<p>Zend Framework comes with interesting and useful components when it comes to authentication and authorization of users. Zend_Auth is one such component whose task is to handle authentication.</p>
<p>I made a little screencast on topic of Zend_Auth database table authentication. Screencast is video only, plus some visual pointers, no audio. Hope some of you find it useful as starting point. <span id="more-1122"></span></p>
<p>I had to slice video onto two parts since YouTube as limit on 10 minute per video.</p>
<p><strong>Zend_Auth Database Table Authentication part 1</strong></p>
<p><object width="425" height="344" data="http://www.youtube.com/v/Mx3lNZb20r4&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Mx3lNZb20r4&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>
<p><strong>Zend_Auth Database Table Authentication part 2</strong></p>
<p><object width="425" height="344" data="http://www.youtube.com/v/jZyJH72Cs10&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/jZyJH72Cs10&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>
<p><strong>Note</strong>: <em>Please consult the official <a href="http://framework.zend.com/manual/">Zend Framework API documentation</a> for detailed overview of Zend_Auth and all other componets.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/zend_auth-database-table-authentification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Core &#8211; PHP LAMP/WAMP stack overview</title>
		<link>http://inchoo.net/zend/zend-core-php-lamp-wamp-stack-overview/</link>
		<comments>http://inchoo.net/zend/zend-core-php-lamp-wamp-stack-overview/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 16:27:04 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=1056</guid>
		<description><![CDATA[For all those in open source web application development, like myself, LAMP/WAMP is well known term, especially if your development is based on PHP. Imagine WAMP with commercial support available and you what to you get? You get Zend Core. I don&#8217;t mean to be harsh neither to WAMP or Zend Core with statements like [...]]]></description>
			<content:encoded><![CDATA[<p>For all those in open source web application development, like myself, LAMP/WAMP is well known term, especially if your development is based on PHP. Imagine WAMP with commercial support available and you what to you get? You get Zend Core. I don&#8217;t mean to be harsh neither to WAMP or Zend Core with statements like these. I&#8217;m simply trying to explain as short as possible, to those interested in Zend Core what it actually is. <span id="more-1056"></span></p>
<p>It is a simplified installation of the full PHP application stack, including web server, databases, extensions and Zend Framework. This last is really interesting if you prefer Zend Framework for development.</p>
<p>Zend Core comes with 3 subscription models (levels): Silver, Gold and Platinum. With prices ranging from $250 &#8211; $750 per dual processor-core. Subscriptions provide support for bug fixes, security patches and maintenance releases for automatic and manual downloading &amp; deployment via the Zend Network. All of this trough Web-based support &amp; phone support.</p>
<p>Below are the screen shots of entire installation process and application overview. I screen shotted entire administration interface, so if you are considering going Zend Core you might find it useful.</p>
<p><img class="alignnone size-medium wp-image-1057" title="Welcome to the ZEND Core 2.5 Installation" src="http://inchoo.net/wp-content/uploads/2009/03/1_instalation-637x514.jpg" alt="Welcome to the ZEND Core 2.5 Installation" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1058" title="License Agreement" src="http://inchoo.net/wp-content/uploads/2009/03/2_instalation-637x514.jpg" alt="License Agreement" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1059" title="ZEND core complete or custom setup" src="http://inchoo.net/wp-content/uploads/2009/03/3_instalation-637x514.jpg" alt="ZEND core complete or custom setup" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1060" title="Installation Destination Location" src="http://inchoo.net/wp-content/uploads/2009/03/4_instalation-637x514.jpg" alt="Installation Destination Location" width="637" height="514" /><br />
<img class="alignnone size-medium wp-image-1061" title="ZEND Apache Install" src="http://inchoo.net/wp-content/uploads/2009/03/5_instalation-637x514.jpg" alt="ZEND Apache Install" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1062" title="Apache Port Number" src="http://inchoo.net/wp-content/uploads/2009/03/6_instalation-637x514.jpg" alt="Apache Port Number" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1063" title="zend extension association" src="http://inchoo.net/wp-content/uploads/2009/03/7_instalation-637x514.jpg" alt="zend extension association" width="637" height="514" /><br />
<img class="alignnone size-medium wp-image-1064" title="zend gui administration password" src="http://inchoo.net/wp-content/uploads/2009/03/8_instalation-637x514.jpg" alt="zend gui administration password" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1065" title="ZEND Network" src="http://inchoo.net/wp-content/uploads/2009/03/9_instalation-637x514.jpg" alt="ZEND Network" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1066" title="proxy configuration" src="http://inchoo.net/wp-content/uploads/2009/03/10_instalation-637x514.jpg" alt="proxy configuration" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1067" title="Install ZEND core" src="http://inchoo.net/wp-content/uploads/2009/03/11_instalation-637x514.jpg" alt="Install ZEND core" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1068" title="Installation progress" src="http://inchoo.net/wp-content/uploads/2009/03/12_instalation-637x514.jpg" alt="Installation progress" width="637" height="514" /></p>
<p><img class="alignnone size-full wp-image-1069" title="Downloading ZEND framework" src="http://inchoo.net/wp-content/uploads/2009/03/13_instalation.jpg" alt="Downloading ZEND framework" width="539" height="437" /></p>
<p><img class="alignnone size-full wp-image-1070" title="ZEND core has downloaded a compressed file" src="http://inchoo.net/wp-content/uploads/2009/03/14_instalation.jpg" alt="ZEND core has downloaded a compressed file" width="471" height="212" /></p>
<p><img class="alignnone size-full wp-image-1071" title="Location of ZEND Core's administration GUI" src="http://inchoo.net/wp-content/uploads/2009/03/15_instalation.jpg" alt="Location of ZEND Core's administration GUI" width="447" height="212" /></p>
<p><img class="alignnone size-medium wp-image-1072" title="zend core v2.5 installed" src="http://inchoo.net/wp-content/uploads/2009/03/16_instalation-637x514.jpg" alt="zend core v2.5 installed" width="637" height="514" /></p>
<p><img class="alignnone size-medium wp-image-1073" title="zend core admin login" src="http://inchoo.net/wp-content/uploads/2009/03/17_core-637x477.jpg" alt="zend core admin login" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1074" title="zend core system overview" src="http://inchoo.net/wp-content/uploads/2009/03/18_core-637x477.jpg" alt="zend core system overview" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1075" title="zend core phpinfo" src="http://inchoo.net/wp-content/uploads/2009/03/19_core-637x477.jpg" alt="zend core phpinfo" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1076" title="benchmark" src="http://inchoo.net/wp-content/uploads/2009/03/20_core-637x477.jpg" alt="benchmark" width="637" height="477" /><br />
<img class="alignnone size-medium wp-image-1077" title="zend core support" src="http://inchoo.net/wp-content/uploads/2009/03/21_core-637x477.jpg" alt="zend core support" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1078" title="zend core update" src="http://inchoo.net/wp-content/uploads/2009/03/22_core-637x477.jpg" alt="zend core update" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1079" title="php configuration" src="http://inchoo.net/wp-content/uploads/2009/03/23_core-637x477.jpg" alt="php configuration" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1080" title="zend core configuration php" src="http://inchoo.net/wp-content/uploads/2009/03/24_core-637x477.jpg" alt="zend core configuration php" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1081" title="zend core extensions" src="http://inchoo.net/wp-content/uploads/2009/03/25_core-637x477.jpg" alt="zend core extensions" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1082" title="zend products configuration" src="http://inchoo.net/wp-content/uploads/2009/03/26_core-637x477.jpg" alt="zend products configuration" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1083" title="zend configuration directives" src="http://inchoo.net/wp-content/uploads/2009/03/27_core-637x477.jpg" alt="zend configuration directives" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1084" title="zend debugger" src="http://inchoo.net/wp-content/uploads/2009/03/28_core-637x477.jpg" alt="zend debugger" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1085" title="zend core php documentation" src="http://inchoo.net/wp-content/uploads/2009/03/29_core-637x477.jpg" alt="zend core php documentation" width="637" height="477" /></p>
<p><img class="alignnone size-medium wp-image-1086" title="search zend core documentation" src="http://inchoo.net/wp-content/uploads/2009/03/30_core-637x477.jpg" alt="search zend core documentation" width="637" height="477" /></p>
<p><img class="alignnone size-full wp-image-1087" title="about zend core" src="http://inchoo.net/wp-content/uploads/2009/03/31_core.jpg" alt="about zend core" width="416" height="465" /></p>
<p><img class="alignnone size-medium wp-image-1088" title="It works!" src="http://inchoo.net/wp-content/uploads/2009/03/32_core-637x477.jpg" alt="It works!" width="637" height="477" /></p>
<p>And that&#8217;s it. Complete screen shot tour of Zend Core.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/zend-core-php-lamp-wamp-stack-overview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend authentication component (Zend_Auth), database storage class</title>
		<link>http://inchoo.net/zend/zend-authentication-component-zend_auth-database-storage-class/</link>
		<comments>http://inchoo.net/zend/zend-authentication-component-zend_auth-database-storage-class/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:16:23 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=1045</guid>
		<description><![CDATA[I love Zend Framework. Sometimes it can really be overhead but most of the time it&#8217;s really nice working in well organized, documented framework. One of the components I use relatively often iz Zend_Auth component. Zend Framework documentation is quite rich so I wont get into explaining how to use Zend_Auth. There is one thing [...]]]></description>
			<content:encoded><![CDATA[<p>I love Zend Framework. Sometimes it can really be overhead but most of the time it&#8217;s really nice working in well organized, documented framework. One of the components I use relatively often iz Zend_Auth component. Zend Framework documentation is quite rich so I wont get into explaining how to use Zend_Auth. There is one thing that bothered me in Zend_Auth, and that&#8217;s persistent storage. Zend_Auth (in the latest version 1.7.6, as of time of this writing) supports only Session state as it&#8217;s storage. What I needed is full database session storage.<br />
<span id="more-1045"></span>Great thing about Zend Framework components is that they come with Interface declaration. So all you need (for the most of the time) in order to replace some part (class) is to write your own class according to provided interface. Below is a working class for saving Zend_Auth state infromation in database.</p>
<p>In order for this to work, you need to call the setStorage method on Zend_Auth prior to calling authenticate method. In my example, I placed following code inside the bootstrap.php file</p>
<pre class="brush: php">
// Setup database connection
$params = array(
&#039;host&#039; =&gt; &#039;server&#039;, // localhost
&#039;dbname&#039; =&gt; &#039;user&#039;,
&#039;username&#039; =&gt; &#039;root&#039;,
&#039;password&#039; =&gt; &#039;somedbpass&#039;,
);

$database = Zend_Db::factory(&#039;Mysqli&#039;, $params);

// Set new session storage mechanizam
$newStore = new AuthDbStorage($database, &#039;MyCookie&#039;, &#039;user&#039;, &#039;email&#039;, 20);
Zend_Auth::getInstance()-&gt;setStorage($newStore);
</pre>
<p>Notice the definition of AuthDbStorage method. It needs 4 parameters to work (5th is optional). First parameter is database adapter, second is cookie name (you need cookie on client side, this is the only info on client side), third parameter is the name of the Zend_Auth table name (the one you set via setTableName), fourth parameter is Zend_Auth identity column name (the one you set via setIdentityColumn), and fifth optional parameter is time to expire a session (in seconds).</p>
<p>If you look at the write method in the class below, you will see it uses two parameters. By default, whatever you write to Zend_Auth default storage (the Session one) it gets overwritten. Here we have somewhat different situation. Here it set it up to accept optional parameter to write some info to additional database column named &#8220;extra&#8221;.</p>
<p>For writting values to current identity, use expression like</p>
<pre class="brush: php">
if(Zend_Auth::getInstance()-&gt;hasIdentity())
{
Zend_Auth::getInstance()-&gt;getStorage()-&gt;write(
Zend_Auth::getInstance()-&gt;getStorage()-&gt;read(),
array(&#039;someKeyName&#039; =&gt; &#039;Some val&#039;, &#039;someKeyName2&#039; =&gt; &#039;Some val2&#039;)
);
}
</pre>
<p>And here is the full class for Zend_Auth database storage.</p>
<pre class="brush: php">
&lt; ?php

class AuthDbStorage implements Zend_Auth_Storage_Interface
{
private static $_session = &#039;session&#039;;

private static $_requiredFieldUserId = &#039;uid&#039;;
private static $_requiredFieldSessionId = &#039;sid&#039;;
private static $_requiredFieldHostname = &#039;hostname&#039;;
private static $_requiredFieldAccessed = &#039;accessed&#039;;
// Extra field to store some info (use serialize)
private static $_requiredFieldExtra = &#039;extra&#039;;

// Zend_Auth Adapter fields
private static $_authAdapterIdentityColumn;
private static $_authAdapterTableName;
private static $_timeToExpire = 600; //in seconds

private static $_cookieName;

private $_db;

public function __construct(Zend_Db_Adapter_Abstract $adapter, $cookieName, $authAdapterTableName, $authAdapterIdentityColumn, $timeToExpire = null)
{
$this-&gt;_db = $adapter;
self::$_cookieName = $cookieName;
self::$_authAdapterTableName = $authAdapterTableName;
self::$_authAdapterIdentityColumn = $authAdapterIdentityColumn;
self::$_timeToExpire = $timeToExpire;
}

/**
* Returns true if and only if storage is empty
*
* @throws Zend_Auth_Storage_Exception If it is impossible to determine whether storage is empty
* @return boolean
*/
public function isEmpty()
{
$result = $this-&gt;_db-&gt;fetchRow(&#039;SELECT * FROM &#039;.self::$_session.&#039; WHERE &#039;.self::$_requiredFieldSessionId.&#039; = ?&#039;, array($_COOKIE[self::$_cookieName]));

if(empty($result)) { return true; }
return false;
}

/**
* Returns the contents of storage
*
* Behavior is undefined when storage is empty.
*
* @throws Zend_Auth_Storage_Exception If reading contents from storage is impossible
* @return mixed
*/
public function read()
{
$result = $this-&gt;_db-&gt;fetchRow(&#039;SELECT * FROM &#039;.self::$_session.&#039; WHERE &#039;.self::$_requiredFieldSessionId.&#039; = ?&#039;, array($_COOKIE[self::$_cookieName]));

if(time() - $result[self::$_requiredFieldAccessed] &gt; self::$_timeToExpire)
{
$this-&gt;clear();
return null;
}
//if (is_null($result)) { throw new Zend_Auth_Storage_Exception(); }
return $result;
}

/**
* Writes $contents to storage
*
* @param mixed $contents
* @throws Zend_Auth_Storage_Exception If writing $contents to storage is impossible
* @return void
*/
public function write($contents, $extraContents = array())
{
if(is_array($contents))
{
$userId = $contents[self::$_requiredFieldUserId];
}

else
{
$userId = $this-&gt;_db-&gt;fetchOne(&#039;SELECT * FROM &#039;.self::$_authAdapterTableName.&#039; WHERE &#039;.self::$_authAdapterIdentityColumn.&#039; = ?&#039;, array($contents));
}

$fields = array(
self::$_requiredFieldUserId =&gt; $userId,
self::$_requiredFieldSessionId =&gt; $_COOKIE[self::$_cookieName],
self::$_requiredFieldHostname =&gt; $_SERVER[&#039;REMOTE_ADDR&#039;],
self::$_requiredFieldAccessed =&gt; time()
);

if(!empty($extraContents))
{
$fields[self::$_requiredFieldExtra] = serialize($extraContents);
}

// Before write, delete all session info
$this-&gt;clear();

// Check to see if session has expired

// Now write new one
$result = $this-&gt;_db-&gt;insert(self::$_session, $fields);

if($result == 0) { throw new Zend_Auth_Storage_Exception(); }

}

/**
* Clears contents from storage
*
* @throws Zend_Auth_Storage_Exception If clearing contents from storage is impossible
* @return void
*/
public function clear()
{
try
{
$this-&gt;_db-&gt;query(&#039;DELETE FROM &#039;.self::$_session.&#039; WHERE &#039;.self::$_requiredFieldSessionId.&#039; = ?&#039;, array($_COOKIE[self::$_cookieName]));
}
catch (Exception $ex)
{
throw new Zend_Auth_Storage_Exception();
}
}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/zend-authentication-component-zend_auth-database-storage-class/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting started with REST using Zend Framework</title>
		<link>http://inchoo.net/zend/getting-started-with-rest-using-zend-framework/</link>
		<comments>http://inchoo.net/zend/getting-started-with-rest-using-zend-framework/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 16:04:24 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Zend]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=644</guid>
		<description><![CDATA[I was playing with SOAP for the last few days. I must say, it looks somewhat complicated in some areas. After some google-ing on SOAP vs REST stuff I decided to write this simple ZendFramework REST how to. Actualy this is a PHP part of tutorial since I was working on a PHP and C# [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing with SOAP for the last few days. I must say, it looks somewhat complicated in some areas. After some google-ing on SOAP vs REST stuff I decided to write this simple ZendFramework REST how to. Actualy this is a PHP part of tutorial since I was working on a PHP and C# solution using Mono framework for C# part can be found on my <a href="http://activecodeline.com/consuming-rest-service-in-mono-with-csharp">site</a>. My desire was to create a web service in PHP environment and consume that service in C# environment.Getting started with REST using ZendFramework. Here&#8217;s the PHP REST server part.</p>
<p>Basic example is really, really simple. Aren&#8217;t they always. Seriously, it&#8217;s not my intention to go into outermost details.<span id="more-644"></span></p>
<p>Creating a REST server in ZendFramework can be simple as 3 lines of code. For the sake of simplicity, let&#8217;s suppose we&#8217;ll place all of our code logic in one file, the IndexController.php. The basic building block of each and every Zend Framework application. Code for creating a REST server looks like</p>
<p><strong><em>public function restAction()<br />
{<br />
$server = new Zend_Rest_Server();<br />
$server-&gt;setClass(&#8216;CustomTestClass&#8217;);<br />
$server-&gt;handle();<br />
exit;<br />
}</em></strong></p>
<p>Notice the <strong>CustomTestClass</strong>? This is the name of the class we wish to make availabe trough REST server. For the sake of simplicity, this class is placed in same file as our IndexController class. Below is the sample of class body</p>
<p><strong><em>class CustomTestClass<br />
{<br />
/**<br />
* Write to a file<br />
*<br />
* @param string $string<br />
* @return string Some return message<br />
*/<br />
public function sayHello($name)<br />
{<br />
$message = &#8216;Hello &#8216;.$name;<br />
return $message;<br />
}<br />
}</em></strong></p>
<p>Now all that&#8217;s left is to make a call to our REST server using GET method. Since our REST server code is placed inside restAction function in IndexController, it can be accessed using url like</p>
<p><strong><em>http://localhost/myzendapp/index.php/index/rest</em></strong></p>
<p>And the result should look like</p>
<p><strong><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;rest generator=&#8221;zend&#8221; version=&#8221;1.0&#8243;&gt;<br />
&lt;response&gt;<br />
&lt;message&gt;No Method Specified.&lt;/message&gt;<br />
&lt;/response&gt;<br />
&lt;status&gt;failed&lt;/status&gt;<br />
&lt;/rest&gt;</em></strong></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/01/direct_link_to_rest_with_no_params.jpeg" rel="lightbox[644]"><img class="alignnone size-thumbnail wp-image-645" title="direct_link_to_rest_with_no_params" src="http://inchoo.net/wp-content/uploads/2009/01/direct_link_to_rest_with_no_params-150x104.jpg" alt="direct_link_to_rest_with_no_params" width="150" height="104" /></a></p>
<p>Although these are error messages, it&#8217;s ok, it means our REST server is working. Now if we were to enter url like</p>
<p><strong><em>http://localhost/myzendapp/index.php/index/rest?method=sayHello</em></strong></p>
<p>we would get response error  message like<br />
<strong><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;CustomTestClass generator=&#8221;zend&#8221; version=&#8221;1.0&#8243;&gt;<br />
&lt;sayHello&gt;<br />
&lt;response&gt;<br />
&lt;message&gt;Invalid Method Call to sayHello. Requires 1, 0 given.&lt;/message&gt;<br />
&lt;/response&gt;<br />
&lt;status&gt;failed&lt;/status&gt;<br />
&lt;/sayHello&gt;<br />
&lt;/CustomTestClass&gt;</em></strong></p>
<p><a href="http://inchoo.net/wp-content/uploads/2009/01/direct_link_to_rest_with_method_assigned_but_no_params.jpeg" rel="lightbox[644]"><img class="alignnone size-thumbnail wp-image-646" title="direct_link_to_rest_with_method_assigned_but_no_params" src="http://inchoo.net/wp-content/uploads/2009/01/direct_link_to_rest_with_method_assigned_but_no_params-150x75.jpg" alt="direct_link_to_rest_with_method_assigned_but_no_params" width="150" height="75" /></a></p>
<p>This too is ok. It simply means we omited the parametars we were supose to pass to function. Remember, our sayHello function has signature like</p>
<p><em>public function sayHello($name)</em></p>
<p>meaning we should pass it a parametar $name. Now if we were to type into our browser url like</p>
<p><strong><em>http://localhost/myzendapp/index.php/index/rest?method=sayHello&amp;name=Branko</em></strong></p>
<p>We would get response like</p>
<p><strong><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;CustomTestClass generator=&#8221;zend&#8221; version=&#8221;1.0&#8243;&gt;<br />
&lt;sayHello&gt;<br />
&lt;response&gt;Hello Branko&lt;/response&gt;<br />
&lt;status&gt;success&lt;/status&gt;<br />
&lt;/sayHello&gt;<br />
&lt;/CustomTestClass&gt;</em></strong></p>
<p>As I said, simple example, more like proof of concept. Hope you find it usefull as a entry point to REST-full Zend development.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/zend/getting-started-with-rest-using-zend-framework/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Review of Zend Studio for Eclipse Professional Edition 6.1</title>
		<link>http://inchoo.net/tools/zend-studio-for-eclipse-professional-edition-6-1/</link>
		<comments>http://inchoo.net/tools/zend-studio-for-eclipse-professional-edition-6-1/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 11:01:21 +0000</pubDate>
		<dc:creator>Branko Ajzele</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=544</guid>
		<description><![CDATA[For the last 3 months, all of my Web development has been done in NetBeans 6.5. I got hooked on it ever since the beta version brought PHP support to it. NetBeans has several great advantages and even greater features to shadow out most of the commercial, freeware, or open source IDE solutions. One of [...]]]></description>
			<content:encoded><![CDATA[<p>For the last 3 months, all of my Web development has been done in NetBeans 6.5. I got hooked on it ever since the beta version brought PHP support to it. NetBeans has several great advantages and even greater features to shadow out most of the commercial, freeware, or open source IDE solutions.</p>
<p>One of the best things about NetBeans is a excellent support for HTML code and added support for jQuery, Prototype, and general JavaScript. However, one thing I simply hate about NetBeans is its speed. Since most of my development is in Magento and WordPress platforms (and Magento itself comes with more than 7000 files), this can really slow down NetBeans. So I decided to look for another solutions, if any <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Today I decided to download and try out the latest Zend Studio release, Zend Studio for Eclipse Professional Edition.<br />
<span id="more-544"></span><br />
You can download the trial version of Zend Studio for Eclipse from http://www.zend.com/en/products/studio/. Zend Studio is not free, it&#8217;s a commercial platform, and although the price might seem high at first, ask yourself what made you even look for Zend Studio as a development IDE solution—and how much time are you wasting right now?<br />
I make my living with PHP and my everyday job evolves around Magento (which is based on Zend Framework platform). My question is: If buying $999 for Zend Studio can make my life a lot easier and speed up my development by some percent, wouldn&#8217;t it be worth the investment? My answer is: Yes, it would. Time saved means more time for new projects.<br />
Enough blabbering, let&#8217;s checkout some Zend Studio features.</p>
<div>After the installation, you are presented with the following screen:</div>
<div>
<div id="rg13"><a href="http://docs.google.com/File?id=ddk3pgmk_110gc4m6ph6_b"><img src="http://docs.google.com/File?id=ddk3pgmk_110gc4m6ph6_b" alt="" width="383" height="295" /></a></div>
</div>
<div>At this point, most of us would jump to File &gt; New section. However, let&#8217;s pause here and get a detailed overview of what this screen offers. Notice the <strong>Browse the Cheat Sheets</strong> section. If you click on it, you get a window like the one below:</div>
<div>
<div id="zwdk"><a href="http://docs.google.com/File?id=ddk3pgmk_111d73sswdz_b"><img src="http://docs.google.com/File?id=ddk3pgmk_111d73sswdz_b" alt="" width="203" height="351" /></a></div>
<div>Now, if you click on the<strong> Creating a PHPDoc</strong>, you get something like the image below:</div>
<div id="zwdk">
<div id="lym8"><a href="http://docs.google.com/File?id=ddk3pgmk_113cp3hp65x_b"><img src="http://docs.google.com/File?id=ddk3pgmk_113cp3hp65x_b" alt="" width="485" height="341" /></a></div>
<div>This might not seem like much to an experienced developer, but it sure helps.</div>
<div>If you go back to the Welcome page of Zend Studio, you will notice a few more useful things, like <strong>Create a Zend Framework Example Project</strong> and <strong>Watch a demo on Event debugging</strong>. I give them 5 out of 5 for this getting started section.</div>
<div>Then, on the right side of the screen there are few intro-level tutorials on essential development topics like Code Assist, Debugging, Profiler, Refactoring, PHPUnit testing, CVS, and SVN. (Unfortunately, most &#8220;wannabe&#8221; developers skip these topics, even though they are essential to healthy application life cycle.)</div>
<div>Now let&#8217;s create our first project. As you know, one of the most annoying things is the time required to manually configure when setting up Zend Framework project. Some of you might say, &#8220;So what, I only have to do it once and paste it every time after.&#8221; Well, this is exactly the scenario I dislike with PHP-related development, everyone seems to have his or her own solution to reinventing the wheel. I love standards; I adore them. This is why I like solutions like this and why I like frameworks—they make you stick to some standard.</div>
<div>Upon creating our new project via File &gt; New &gt; Zend Framework Project, we get a working Zend app that echoes simple Hello, world! to browser. Actually, we still need to copy/paste Zend Framework library to the /library directory and we are done. This is simply beautiful; I love it.</div>
<div>Below is the example of the bootsrap.php file it generated for us:</div>
<div id="lym8">
<div id="gp_."><a href="http://docs.google.com/File?id=ddk3pgmk_114cddq8h2g_b"><img src="http://docs.google.com/File?id=ddk3pgmk_114cddq8h2g_b" alt="" width="485" height="341" /></a></div>
</div>
</div>
</div>
<div>And below is a screenshot of auto-generated IndexController.php file with <strong>Code Assistant</strong> in action:</div>
<div>
<div id="mxx4"><a href="http://docs.google.com/File?id=ddk3pgmk_115dhffhjck_b"><img src="http://docs.google.com/File?id=ddk3pgmk_115dhffhjck_b" alt="" width="485" height="341" /></a></div>
</div>
<div>I do have some minor criticisms on Code Assistant behavior that I noticed. For example, if you were to write into your controller file something like</div>
<div><em>$this-&gt;view-&gt;assign(&#8220;username&#8221;, &#8220;branko.ajzele&#8221;);</em></div>
<div><em><br />
</em></div>
<div>and now if in your view file you try to write something like</div>
<p><em>$this-&gt;use&#8230; </em></p>
<div>
<div>then you won&#8217;t get auto complete from Code Assistant. It does not seem to recognize this kind of connection.</div>
<div>Another problem with Code Assistant is that it behaves differently in .phtml files and html files when writing html code. It does not work very well in .phtml files in this case. However, despite these problems, Zend Studio is still a powerful and extremely useful developer tool.</div>
<div>One of the first features I looked for in Zend Studio was its ability to manage database connections. There is a nice little icon on the main toolbar called <strong>Create new SQL connection</strong> (Oracle, Postgre, MySQL, MS SQL, Derby, IBM DB2, their variations and addition of new ones).</div>
<div>
<div id="a575"><a href="http://docs.google.com/File?id=ddk3pgmk_116c5cmgzgr_b"><img src="http://docs.google.com/File?id=ddk3pgmk_116c5cmgzgr_b" alt="" width="346" height="326" /></a></div>
</div>
<div>Combined with a nice little feature called Scrapbook, we get simple but effective developer to database relation solutions. It&#8217;s so easy you may never look back at other solutions again!</div>
<div>Below is the screenshot of Zend Studio&#8217;s Database Development Perspective view:</div>
<div>
<div id="vw4."><a href="http://docs.google.com/File?id=ddk3pgmk_11772bpjccj_b"><img src="http://docs.google.com/File?id=ddk3pgmk_11772bpjccj_b" alt="" width="389" height="262" /></a></div>
</div>
</div>
<p>This brings me to the next topic, <strong>Perspective view</strong>. This too might not look as cool or seem necessary, but I love it. In my opinion it&#8217;s a step in right direction towards smart applications. Zend Studio Eclipse uses this concept of Perspective views (the way of rearranging the application interface based on the technology you&#8217;re working on) from PHP to SQL.</p>
<div>Another cool feature not many PHP IDE&#8217;s have is a <strong>PHPDoc generator</strong>. Below is a screenshot of generated documentation on my empty application. I only wrote one empty method inside IndexController.php file and assigned it some description. All you need to do is go to Project &gt; Generate PHPDoc and that&#8217;s it. Your documentation will be built in a matter of seconds.</div>
<div>
<div id="m5j2"><a href="http://docs.google.com/File?id=ddk3pgmk_118chddfrcr_b"><img src="http://docs.google.com/File?id=ddk3pgmk_118chddfrcr_b" alt="" width="605" height="370" /></a></div>
<p><strong>Remote Systems monitor</strong> is another cool and extremely useful feature. Below are two screenshots for you to see it:</div>
<div id="v4qp"><a href="http://docs.google.com/File?id=ddk3pgmk_120gphm8ngb_b"><img src="http://docs.google.com/File?id=ddk3pgmk_120gphm8ngb_b" alt="" width="315" height="340" /></a></div>
<div>
<div id="v4qp">
<div id="ggg."><a href="http://docs.google.com/File?id=ddk3pgmk_121htns4sgk_b"><img src="http://docs.google.com/File?id=ddk3pgmk_121htns4sgk_b" alt="" width="389" height="262" /></a></div>
<div>Everything mentioned so far is just a fraction of what Zend Studio Eclipse is made of and what it can enable you to do.</div>
<div>I recommend you try it out.</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools/zend-studio-for-eclipse-professional-edition-6-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
