<?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>Claudio&#039;s Hideout &#187; article</title>
	<atom:link href="http://claudio.cicali.name/post/tag/article/feed/" rel="self" type="application/rss+xml" />
	<link>http://claudio.cicali.name</link>
	<description>Claudio Cicali web hub</description>
	<lastBuildDate>Sun, 25 Sep 2011 11:29:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>The new providers discovery for Zend_Tool 1.10</title>
		<link>http://claudio.cicali.name/post/2010/03/the-new-providers-discovery-for-zend-tool-1-10/</link>
		<comments>http://claudio.cicali.name/post/2010/03/the-new-providers-discovery-for-zend-tool-1-10/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 13:06:30 +0000</pubDate>
		<dc:creator>claudio</dc:creator>
				<category><![CDATA[Articoli]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://claudio.cicali.name/?p=732</guid>
		<description><![CDATA[With the recent release of the 1.10 version of the  Zend Framework, they made a subtle change on how Zend_Tool searches its providers. Before 1.10 the loader (aka the provider discover) was set to be the IncludePathLoader class; what that meens is that if you wrote a new provider, all that you needed to do to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://framework.zend.com/"><img class="alignleft size-full wp-image-735" title="zf-logo" src="http://claudio.cicali.name/wp-content/uploads/2010/03/zf-logo.jpg" alt="" width="150" height="84" /></a></p>
<p>With the recent release of the 1.10 version of the  Zend Framework, they made a subtle change on how <a href="http://framework.zend.com/manual/1.10/en/zend.tool.html">Zend_Tool</a> searches its providers. Before 1.10 the loader (aka the provider discover) was set to be the <strong>IncludePathLoader</strong> class; what that meens is that if you wrote a new provider, all that you needed to do to have Zend_Tool automatically find it was to edit your PHP&#8217;s include_path or add your provider&#8217;s directory to the ZEND_TOOL_INCLUDE_PATH_PREPEND environment variable.</p>
<p>Now that is history, because (<a href="http://n4.nabble.com/Several-issues-for-Zend-Tool-1-10-td1555536.html">source</a>):</p>
<blockquote><p>There were many issues for people when Zend_Tool used a scanning approach to finding providers. This caused many issues on all different platforms.  Now we&#8217;ve opted to go the specify your providers approach.</p></blockquote>
<p>(beware: the suggested solution in that post is wrong)</p>
<p>So if you ever write a new tool provider remember that there&#8217;s no more &#8220;auto discovery&#8221; by scanning the path. The loader now is the <strong>BasicLoader</strong> and you have to explicitely tell Zend_Tool where <strong>your</strong> providers are and how their classes are named. For this to happen, you can use the <strong>zf enable config.provider</strong> command or use the <strong>zf.ini</strong> file.</p>
<p>My solution is:</p>
<ul>
<li>create a <strong>zf.ini</strong> file for your project. This is slighlty different from what the documentation implies; it considers zf.ini to be an hidden file in your $HOME. But this is only a default you can change via the  ﻿ZF_CONFIG_FILE env variable</li>
<li>put something like <strong>basicloader.classes.0 = &#8220;Migrations_MigrationProvider&#8221;</strong> as the first line (that example is the actual class name of my migration tool provider)</li>
<li>assure that your class can be loaded, setting ZEND_TOOL_INCLUDE_PATH_PREPEND accordingly</li>
</ul>
<p>On the same topic you can also read <a href="http://framework.zend.com/issues/browse/ZF-8899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel">this issue</a>.</p>
<p>As a bonus track, below is a little bash script I use to run my migration tool.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

APPPATH=$(readlink -f ..)/app

export ZF_CONFIG_FILE=${APPPATH}/../zf.ini

if [ ! -f ${ZF_CONFIG_FILE} ]; then
  echo &quot;Non trovo zf.ini&quot;
  echo &quot;Forse non stai eseguendo questo programma dalla directory DB?&quot;
  exit -1
fi

if [[ &quot;${ZF_BIN_DIR}&quot; == &quot;&quot; ]]; then
  ZF_BIN_DIR=$(readlink -f ../vendor/Zend)/../../bin
  ZF_BIN_DIR=$(readlink -f ${ZF_BIN_DIR})
fi

if [ ! -f ${ZF_BIN_DIR}/zf.sh ]; then
  echo &quot;Non trovo zf.sh in &quot; ${ZF_BIN_DIR}
  echo &quot;Forse non stai eseguendo questo programma dalla directory DB?&quot;
  exit -1
fi

MIGCLASSDIR=$(readlink -f ../vendor/Renomo/library)

if [ ! -d ${MIGCLASSDIR} ]; then
  echo &quot;Impossibile trovare la directory della classe Migration&quot;
  exit -1
fi

MIGDIR=$(readlink -f migrations)

if [ ! -d ${MIGDIR} ]; then
  echo &quot;Impossibile trovare la directory delle migration&quot;
  exit -1
fi

export ZEND_TOOL_INCLUDE_PATH_PREPEND=${MIGCLASSDIR}

${ZF_BIN_DIR}/zf.sh run migration ${1}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://claudio.cicali.name/post/2010/03/the-new-providers-discovery-for-zend-tool-1-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

