|
|
@@ -1,6 +1,6 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<!-- Reviewed: no -->
|
|
|
-<!-- EN-Revision: 18840 -->
|
|
|
+<!-- EN-Revision: 19568 -->
|
|
|
<sect1 id="zend.tool.framework.writing-providers">
|
|
|
<title>Zend_Tool_Frameworkを利用してプロバイダを作成する</title>
|
|
|
|
|
|
@@ -73,24 +73,24 @@
|
|
|
with a special filename ending with "Manifest.php".
|
|
|
A Provider Manifest is an implementation of the
|
|
|
<interface>Zend_Tool_Framework_Manifest_ProviderManifestable</interface>
|
|
|
- and requires the <code>getProviders()</code> method to return
|
|
|
+ and requires the <methodname>getProviders()</methodname> method to return
|
|
|
an array of instantiated providers. In anticipation of our first
|
|
|
own provider <classname>My_Component_HelloProvider</classname>
|
|
|
we will create the following manifest:
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
- class My_Component_Manifest implements Zend_Tool_Framework_Manifest_ProviderManifestable
|
|
|
+class My_Component_Manifest
|
|
|
+ implements Zend_Tool_Framework_Manifest_ProviderManifestable
|
|
|
+{
|
|
|
+ public function getProviders()
|
|
|
{
|
|
|
- public function getProviders()
|
|
|
- {
|
|
|
- return array(
|
|
|
- new My_Component_HelloProvider()
|
|
|
- );
|
|
|
- }
|
|
|
+ return array(
|
|
|
+ new My_Component_HelloProvider()
|
|
|
+ );
|
|
|
}
|
|
|
- ]]>
|
|
|
- </programlisting>
|
|
|
+}
|
|
|
+]]></programlisting>
|
|
|
|
|
|
</example>
|
|
|
</sect2>
|
|
|
@@ -139,8 +139,9 @@ Hello from my provider!
|
|
|
<para>
|
|
|
As discussed in the architecture section Zend Tool allows to hook different clients for
|
|
|
using your Zend Tool providers. To keep compliant with different clients you should
|
|
|
- use the response object to return messages from your providers instead of using <code>echo</code>
|
|
|
- or a similiar output mechanism. Rewritting our hello provider with this knowledge it looks like:
|
|
|
+ use the response object to return messages from your providers instead of using
|
|
|
+ <methodname>echo()</methodname> or a similiar output mechanism. Rewritting our hello
|
|
|
+ provider with this knowledge it looks like:
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
@@ -149,11 +150,11 @@ class My_Component_HelloProvider
|
|
|
{
|
|
|
public function say()
|
|
|
{
|
|
|
- $this->_registry->getResponse()->appendContent("Hello from my provider!");
|
|
|
+ $this->_registry->getResponse
|
|
|
+ ->appendContent("Hello from my provider!");
|
|
|
}
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
|
|
|
<!-- TODO: to be translated -->
|
|
|
<para>
|
|
|
@@ -226,14 +227,15 @@ class My_Component_HelloProvider
|
|
|
{
|
|
|
public function say($name = 'Ralph')
|
|
|
{
|
|
|
- $nameResponse = $this->_registry->getClient()->promptInteractiveInput("Whats your name?");
|
|
|
+ $nameResponse = $this->_registry
|
|
|
+ ->getClient()
|
|
|
+ ->promptInteractiveInput("Whats your name?");
|
|
|
$name = $name->getContent();
|
|
|
|
|
|
echo 'Hello' . $name . ', from my provider!';
|
|
|
}
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
|
|
|
<!-- TODO: to be translated -->
|
|
|
<para>
|
|
|
@@ -317,8 +319,7 @@ class My_Component_HelloProvider
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
</sect3>
|
|
|
|
|
|
<sect3 id="zend.tool.framework.writing-providers.advanced.configstorage">
|
|
|
@@ -347,14 +348,14 @@ class My_Component_HelloProvider
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
|
|
|
<!-- TODO: to be translated -->
|
|
|
<para>
|
|
|
- The returned configuration is of the type <classname>Zend_Tool_Framework_Client_Config</classname>
|
|
|
- but internally the <code>__get</code> and <code>__set</code> magic methods proxy to a
|
|
|
- <classname>Zend_Config</classname> of the given configuration type.
|
|
|
+ The returned configuration is of the type
|
|
|
+ <classname>Zend_Tool_Framework_Client_Config</classname> but internally the
|
|
|
+ <methodname>__get</methodname> and <methodname>__set</methodname> magic methods
|
|
|
+ proxy to a <classname>Zend_Config</classname> of the given configuration type.
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
@@ -373,8 +374,7 @@ class My_Component_HelloProvider
|
|
|
echo "Hello $aValue!";
|
|
|
}
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
|
|
|
<para>
|
|
|
ストレージ API はとても簡単です。
|
|
|
@@ -391,8 +391,7 @@ class Zend_Tool_Framework_Client_Storage
|
|
|
public function remove($name);
|
|
|
public function getStreamUri($name);
|
|
|
}
|
|
|
-]]>
|
|
|
- </programlisting>
|
|
|
+]]></programlisting>
|
|
|
|
|
|
<!-- TODO: to be translated -->
|
|
|
<important>
|