Просмотр исходного кода

[DOCUMENTATION] Japanese sync 18196, 18210

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18215 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 лет назад
Родитель
Сommit
d88baef1da

+ 42 - 15
documentation/manual/ja/module_specs/Zend_Db_Select.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<!-- EN-Revision: 17600 -->
+<!-- EN-Revision: 18196 -->
 <sect1 id="zend.db.select">
 
     <title>Zend_Db_Select</title>
@@ -161,7 +161,7 @@ $select = $db->select()
 
             <para>
                 このクエリのテーブルを指定するために <methodname>from()</methodname>
-                メソッドを使用します。テーブル名は、単純に文字列で指定することができます。
+                メソッドを使用します。テーブル名は、単純に文字列で指定できます。
                 <classname>Zend_Db_Select</classname> はテーブル名を識別子としてクォートするので、
                 特殊文字を使用することもできます。
             </para>
@@ -208,7 +208,7 @@ $select = $db->select()
             <para>
                 <acronym>RDBMS</acronym> によっては、テーブル名の前にスキーマ名をつなげる方式をサポートしているものもあります。
                 テーブル名として、"<code>schemaName.tableName</code>"
-                のように指定することができます。この場合、
+                のように指定できます。この場合、
                 <classname>Zend_Db_Select</classname> は各部分を個別にクォートします。
                 あるいはスキーマ名とテーブル名を別々に指定することもできます。
                 もし両方でスキーマ名を指定した場合は、
@@ -243,7 +243,7 @@ $select = $db->select()
 
             <para>
                 <methodname>from()</methodname> メソッドの二番目の引数で、
-                対応するテーブルから取得するカラムを指定することができます。
+                対応するテーブルから取得するカラムを指定できます。
                 カラムを指定しなかった場合のデフォルトは
                 "<code>*</code>" で、これは "すべてのカラム"
                 を表す <acronym>SQL</acronym> のワイルドカードです。
@@ -398,7 +398,7 @@ $select = $db->select()
             <para>
                 クォート処理を直接文字列に埋め込んでしまわずに
                 <methodname>quoteIdentifier()</methodname> メソッドを使用することで、
-                あなたのコードをデータベースに依存しないものにすることができます。
+                あなたのコードをデータベースに依存しないものにできます。
                 というのも、<acronym>RDBMS</acronym> によってはあまり標準的ではない文字でクォートを行うものもあるからです。
                 <methodname>quoteIdentifier()</methodname> メソッドは、
                 アダプタの型に応じて適切なクォート文字を使用するように設計されています。
@@ -434,7 +434,7 @@ $select = $db->select()
                 既存の FROM や JOIN のテーブルに対して、それらのメソッドをコールした後で
                 カラムを追加したくなることもあるかもしれません。
                 <methodname>columns()</methodname> メソッドを使用すると、
-                クエリを実行する前ならいつでも好きなときに特定のカラムを追加することができます。
+                クエリを実行する前ならいつでも好きなときに特定のカラムを追加できます。
                 カラムは、文字列あるいは <classname>Zend_Db_Expr</classname>、
                 あるいはその配列で指定します。
                 このメソッドの 2 番目の引数は省略可能です。
@@ -505,7 +505,7 @@ $select = $db->select()
                 <methodname>join()</methodname> の二番目の引数として、
                 結合条件を文字列で指定します。これは、
                 あるテーブルの行が別のテーブルのどの行と対応するのかを表す条件式です。
-                式の中では相関名を使用することができます。
+                式の中では相関名を使用できます。
             </para>
 
             <note>
@@ -691,7 +691,7 @@ $select = $db->select()
 
             <para>
                 これらの結合メソッドに加え、クエリを単純にするために
-                JoinUsing メソッドを使用することができます。完全な結合条件を渡すかわりに、
+                JoinUsing メソッドを使用できます。完全な結合条件を渡すかわりに、
                 単純に結合するカラム名の配列を渡してやれば
                 <classname>Zend_Db_Select</classname> オブジェクトが結合条件を作成してくれます。
             </para>
@@ -967,7 +967,7 @@ $select = $db->select()
 
             <para>
                 <methodname>from()</methodname> メソッドでのカラムの配列と同様、
-                カラム名には相関名を使用することができます。また、
+                カラム名には相関名を使用できます。また、
                 カラム名は識別子としてクォートされます。
                 ただし、文字列に括弧が含まれたり
                 <classname>Zend_Db_Expr</classname> 型のオブジェクトを指定したりした場合は別です。
@@ -1181,7 +1181,7 @@ $select = $db->select()
 
             <para>
                 <methodname>distinct()</methodname> メソッドを使用すると、<acronym>SQL</acronym> クエリに
-                <constant>DISTINCT</constant> キーワードを追加することができます。
+                <constant>DISTINCT</constant> キーワードを追加できます。
             </para>
 
             <example id="zend.db.select.building.distinct.example">
@@ -1208,7 +1208,7 @@ $select = $db->select()
 
             <para>
                 <methodname>forUpdate()</methodname> メソッドを使用すると、<acronym>SQL</acronym> クエリに
-                <code>FOR UPDATE</code> 修飾子を追加することができます。
+                <code>FOR UPDATE</code> 修飾子を追加できます。
             </para>
 
             <example id="zend.db.select.building.for-update.example">
@@ -1229,6 +1229,33 @@ $select = $db->select()
 
         </sect3>
 
+        <sect3 id="zend.db.select.building.union">
+            <title>UNION クエリの構築</title>
+
+            <para>
+                <methodname>union()</methodname>メソッドに<classname>Zend_Db_Select</classname>の配列、
+                または SQL クエリ文字列を渡すことによって、
+                <classname>Zend_Db_Select</classname>で結合クエリを構築できます。
+                どの種類の結合を実行したいか指定するために、
+                第2引数として、<constant>Zend_Db_Select::SQL_UNION</constant>、
+                または<constant>Zend_Db_Select::SQL_UNION_ALL</constant>定数を渡せます。
+            </para>
+
+            <example id="zend.db.select.building.union.example">
+                <title>union() メソッド例</title>
+
+                <programlisting language="php"><![CDATA[
+$sql1 = $db->select();
+$sql2 = "SELECT ...";
+
+$select = $db->select()
+    ->union(array($sql1, $sql2))
+    ->order("id");
+]]>
+                </programlisting>
+            </example>
+        </sect3>
+
     </sect2>
 
     <sect2 id="zend.db.select.execute">
@@ -1352,7 +1379,7 @@ echo "$sql\n";
                 たとえば、このメソッドを使用すると、
                 <constant>WHERE</constant> 句の式を表す配列や
                 <constant>SELECT</constant> するカラム (あるいは式) の配列、または
-                <constant>LIMIT</constant> 句のカウントやオフセットを取得することができます。
+                <constant>LIMIT</constant> 句のカウントやオフセットを取得できます。
             </para>
 
             <para>
@@ -1372,7 +1399,7 @@ echo "$sql\n";
 
             <para>
                 <classname>Zend_Db_Select</classname> クラスでは、<acronym>SQL</acronym> クエリの各部分を指定するための定数を定義しています。
-                これらの定数、あるいはリテラル文字列のいずれかで指定することができます。
+                これらの定数、あるいはリテラル文字列のいずれかで指定できます。
             </para>
 
             <table id="zend.db.select.other.get-part.table">
@@ -1450,7 +1477,7 @@ $select = $db->select()
              ->from('products')
              ->order('product_id');
 
-// 文字列リテラルを使用して指定することができます
+// 文字列リテラルを使用して指定できます
 $orderData = $select->getPart( 'order' );
 
 // 同じことを、定数を用いて指定することもできます
@@ -1471,7 +1498,7 @@ print_r( $orderData );
 
             <para>
                 <methodname>reset()</methodname> メソッドを使用すると、
-                <acronym>SQL</acronym> クエリの指定した部分のみを消去することができます。
+                <acronym>SQL</acronym> クエリの指定した部分のみを消去できます。
                 引数を省略した場合は、すべての部分を消去します。
             </para>
 

+ 2 - 2
documentation/manual/ja/ref/performance-view.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<!-- EN-Revision: 16183 -->
+<!-- EN-Revision: 18210 -->
 <sect1 id="performance.view">
     <title>ビューのレンダリング</title>
 
@@ -97,7 +97,7 @@ class My_View extends Zend_View
     ) {
         if (!array_key_exists('url', $this->_localHelperObjects)) {
             $this->_localHelperObjects['url'] = new Zend_View_Helper_Url();
-            $this->_localHelperObjects['url']->setView($view);
+            $this->_localHelperObjects['url']->setView($this);
         }
         $helper = $this->_localHelperObjects['url'];
         return $helper->url($urlOptions, $name, $reset, $encode);

+ 413 - 0
documentation/manual/ja/ref/project-structure.xml

@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<!-- EN-Revision: 18056 -->
+<appendix id="project-structure">
+    <title>Zend Framework MVC アプリケーションのために推奨されるプロジェクト構造</title>
+
+    <sect1 id="project-structure.overview">
+        <title>概要</title>
+
+        <para>
+            たくさんの開発者が、比較的柔軟な環境でZend Frameworkプロジェクトのための
+            最善のプロジェクト構造のガイダンスを望みます。
+            「柔軟な」環境とは、
+            それらのアプリケーションを実行し、かつ安全にするための
+            最も理想的なプロジェクト構造を達成するために、
+            必要に応じてそれらのファイルシステムとウェブサーバ構成を開発者が操作できる
+            環境です。
+            デフォルトのプロジェクト構造では、
+            それらの配置で開発者がそのような柔軟性を持つと仮定します。
+        </para>
+
+        <para>
+            以下のディレクトリ構造は、
+            複雑なプロジェクトのために最大限に拡張可能に設計されています。
+            その一方で、プロジェクトのためのフォルダとファイルの単純なサブセットを
+            より単純な必要条件で提示します。
+            この構造も、モジュラー及び非モジュラー両方のZend Frameworkアプリケーションのために、
+            変更なしで動作します。
+            <filename>.htaccess</filename>ファイルは、
+            この付録に含まれる<link linkend="project-structure.rewrite">リライト構成ガイド</link>
+            で定めるウェブサーバでも、<acronym>URL</acronym>リライト機能を必要とします。
+        </para>
+
+        <para>
+            このプロジェクト構造で、可能性があるすべてのZend Frameworkプロジェクト条件を
+            サポートすることは意図していません。
+            <classname>Zend_Tool</classname>によって使われるデフォルトのプロジェクト・プロフィールは、
+            このプロジェクト構造を反映します。
+            しかし、この構造でサポートされない必要条件を持つアプリケーションでは、
+            カスタム・プロジェクト・プロフィールを使わなければなりません。
+        </para>
+    </sect1>
+
+    <sect1 id="project-structure.project">
+        <title>推奨されるプロジェクト・ディレクトリ構造</title>
+
+        <programlisting language="txt"><![CDATA[
+<project name>/
+    application/
+        configs/
+            application.ini
+        controllers/
+            helpers/
+        forms/
+        layouts/
+            filters/
+            helpers/
+            scripts/
+        models/
+        modules/
+        services/
+        views/
+            filters/
+            helpers/
+            scripts/
+        Bootstrap.php
+    data/
+        cache/
+        indexes/
+        locales/
+        logs/
+        sessions/
+        uploads/
+    docs/
+    library/
+    public/
+        css/
+        images/
+        js/
+        .htaccess
+        index.php
+    scripts/
+        jobs/
+        build/
+    temp/
+    tests/
+]]></programlisting>
+
+        <para>
+            以下では、一覧に記載されたディレクトリ毎に利用例を記述します。
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><filename>application/</filename></emphasis>:
+                    このディレクトリは、アプリケーションを含みます。
+                    構成や利用されるサービス、及びブートストラップ・ファイルと同様に、
+                    <acronym>MVC</acronym>システムを収納します。
+                </para>
+
+                <itemizedlist>
+                    <listitem>
+                        <para>
+                            <emphasis><filename>configs/</filename></emphasis>:
+                            アプリケーション全体の設定のディレクトリ
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>controllers/</filename></emphasis>,
+                            <emphasis><filename>models/</filename></emphasis>,
+                            <emphasis><filename>views/</filename></emphasis>:
+                            <!-- TODO -->
+                            These directories
+                            serve as the default controller, model or view directories. Having
+                            these three directories inside the application directory provides the
+                            best layout for starting a simple project as well as starting a modular
+                            project that has global <filename>controllers/models/views</filename>.
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>controllers/helpers/</filename></emphasis>: These
+                            directories will contain action helpers. Action helpers will be
+                            namespaced either as "<classname>Controller_Helper_</classname>" for
+                            the default module or "&lt;Module&gt;_Controller_Helper" in other
+                            modules.
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>layouts/</filename></emphasis>: This layout
+                            directory is for <acronym>MCV</acronym>-based layouts. Since
+                            <classname>Zend_Layout</classname> is capable of
+                            <acronym>MVC</acronym>- and non-<acronym>MVC</acronym>-based layouts,
+                            the location of this directory reflects that layouts are not on a
+                            1-to-1 relationship with controllers and are independent of templates
+                            within <filename>views/</filename>.
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>modules/</filename></emphasis>: Modules allow a
+                            developer to group a set of related controllers into a logically
+                            organized group. The structure under the modules directory would
+                            resemble the structure under the application directory.
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>services/</filename></emphasis>: This directory is
+                            for your application specific web-service files that are provided by
+                            your application, or for implementing a <ulink
+                                url="http://www.martinfowler.com/eaaCatalog/serviceLayer.html">Service
+                                Layer</ulink> for your models.
+                        </para>
+                    </listitem>
+
+                    <listitem>
+                        <para>
+                            <emphasis><filename>Bootstrap.php</filename></emphasis>: This file is
+                            the entry point for your application, and should implement
+                            <classname>Zend_Application_Bootstrap_Bootstrapper</classname>.
+                            The purpose for this file is to bootstrap the application and make
+                            components available to the application by initializing them.
+                        </para>
+                    </listitem>
+                </itemizedlist>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>data/</filename></emphasis>: This directory provides a
+                    place to store application data that is volatile and possibly temporary. The
+                    disturbance of data in this directory might cause the application to fail.
+                    Also, the information in this directory may or may not be committed to a
+                    subversion repository. Examples of things in this directory are session files,
+                    cache files, sqlite databases, logs and indexes.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>docs/</filename></emphasis>: This directory contains
+                    documentation, either generated or directly authored.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>library/</filename></emphasis>: This directory is for
+                    common libraries on which the application depends, and should be on the
+                    <acronym>PHP</acronym> <property>include_path</property>. Developers should
+                    place their application's library code under this directory in a unique
+                    namespace, following the guidelines established in the <acronym>PHP</acronym>
+                    manual's <ulink
+                        url="http://www.php.net/manual/en/userlandnaming.php">Userland Naming
+                        Guide</ulink>, as well as those established by Zend itself. This
+                    directory may also include Zend Framework itself; if so, you would house it in
+                    <filename>library/Zend/</filename>.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>public/</filename></emphasis>: This directory contains all
+                    public files for your application. <filename>index.php</filename> sets up and
+                    invokes <classname>Zend_Application</classname>, which in turn invokes the
+                    <filename>application/Bootstrap.php</filename> file, resulting in dispatching
+                    the front controller. The web root of your web server would typically be set to
+                    this directory.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>scripts/</filename></emphasis>: This directory contains
+                    maintenance and/or build scripts. Such scripts might include command line,
+                    cron, or phing build scripts that are not executed at runtime but are part of
+                    the correct functioning of the application.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>temp/</filename></emphasis>: The <filename>temp/</filename>
+                    folder is set aside for transient application data. This information would not
+                    typically be committed to the applications svn repository. If data under the
+                    <filename>temp/</filename> directory were deleted, the application should be
+                    able to continue running with a possible decrease in performance until data is
+                    once again restored or recached.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><filename>tests/</filename></emphasis>: This directory contains
+                    application tests. These could be hand-written, PHPUnit tests, Selenium-RC
+                    based tests or based on some other testing framework. By default, library code
+                    can be tested by mimicing the directory structure of your
+                    <filename>library/</filename> directory. Additionally, functional tests for
+                    your application could be written mimicing the
+                    <filename>application/</filename> directory structure (including the
+                    application subdirectory).
+                </para>
+            </listitem>
+        </itemizedlist>
+    </sect1>
+
+    <sect1 id="project-structure.filesystem">
+        <title>モジュール構造</title>
+
+        <para>
+            The directory structure for modules should mimic that of the
+            <filename>application/</filename> directory in the recommended project structure:
+        </para>
+
+        <programlisting language="xml"><![CDATA[
+<modulename>
+    configs/
+        application.ini
+    controllers/
+        helpers/
+    forms/
+    layouts/
+        filters/
+        helpers/
+        scripts/
+    models/
+    services/
+    views/
+        filters/
+        helpers/
+        scripts/
+    Bootstrap.php
+]]></programlisting>
+
+        <para>
+            The purpose of these directories remains exactly the same as for the recommended
+            project directory structure.
+        </para>
+    </sect1>
+
+    <sect1 id="project-structure.rewrite">
+        <title>リライト設定ガイド</title>
+
+        <para>
+            <acronym>URL</acronym> rewriting is a common function of <acronym>HTTP</acronym>
+            servers. However, the rules and configuration differ widely between them. Below are
+            some common approaches across a variety of popular web servers available at the time of
+            writing.
+        </para>
+
+        <sect2 id="project-structure.rewrite.apache">
+            <title>Apache HTTPサーバ</title>
+
+            <para>
+                All examples that follow use <property>mod_rewrite</property>, an official
+                module that comes bundled with Apache. To use it,
+                <property>mod_rewrite</property> must either be included at compile time or
+                enabled as a Dynamic Shared Object (<acronym>DSO</acronym>). Please consult the
+                <ulink url="http://httpd.apache.org/docs/">Apache documentation</ulink> for your
+                version for more information.
+            </para>
+
+            <sect3 id="project-structure.rewrite.apache.vhost">
+                <title>バーチャルホスト内でのリライト</title>
+
+                <para>
+                    Here is a very basic virtual host definition. These rules direct all requests
+                    to <filename>index.php</filename>, except when a matching file is found under
+                    the <property>document_root</property>.
+                </para>
+
+                <programlisting language="xml"><![CDATA[
+<VirtualHost my.domain.com:80>
+    ServerName   my.domain.com
+    DocumentRoot /path/to/server/root/my.domain.com/public
+
+    RewriteEngine off
+
+    <Location />
+        RewriteEngine On
+        RewriteCond %{REQUEST_FILENAME} -s [OR]
+        RewriteCond %{REQUEST_FILENAME} -l [OR]
+        RewriteCond %{REQUEST_FILENAME} -d
+        RewriteRule ^.*$ - [NC,L]
+        RewriteRule ^.*$ /index.php [NC,L]
+    </Location>
+</VirtualHost>
+]]></programlisting>
+
+                <para>
+                    Note the slash ("/") prefixing <filename>index.php</filename>; the rules for
+                    <filename>.htaccess</filename> differ in this regard.
+                </para>
+            </sect3>
+
+            <sect3 id="project-structure.rewrite.apache.htaccess">
+                <title>.htaccessファイル内でのリライト</title>
+
+                <para>
+                    下記は<property>mod_rewrite</property>を利用する
+                    <filename>.htaccess</filename>ファイルの例です。
+                    It is similar to the virtual host
+                    configuration, except that it specifies only the rewrite rules, and the leading
+                    slash is omitted from <filename>index.php</filename>.
+                </para>
+
+                <programlisting language="text"><![CDATA[
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} -s [OR]
+RewriteCond %{REQUEST_FILENAME} -l [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule ^.*$ - [NC,L]
+RewriteRule ^.*$ index.php [NC,L]
+]]></programlisting>
+
+                <para>
+                    <property>mod_rewrite</property>を設定する方法はたくさんあります。
+                    もし、詳細をお好みでしたら、Jayson Minard の<ulink
+                        url="http://devzone.zend.com/a/70">Blueprint for PHP Applications:
+                    Bootstrapping</ulink>をご覧下さい。
+                </para>
+            </sect3>
+
+        </sect2>
+
+        <sect2 id="project-structure.rewrite.iis">
+            <title>Microsoft Internet Information サーバ</title>
+
+            <para>
+                As of version 7.0, <acronym>IIS</acronym> now ships with a standard rewrite engine.
+                You may use the following configuration to create the appropriate rewrite rules.
+            </para>
+
+            <programlisting language="xml"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <system.webServer>
+        <rewrite>
+            <rules>
+                <rule name="Imported Rule 1" stopProcessing="true">
+                    <match url="^.*$" />
+                    <conditions logicalGrouping="MatchAny">
+                        <add input="{REQUEST_FILENAME}"
+                             matchType="IsFile" pattern=""
+                             ignoreCase="false" />
+                        <add input="{REQUEST_FILENAME}"
+                             matchType="IsDirectory"
+                             pattern=""
+                             ignoreCase="false" />
+                    </conditions>
+                    <action type="None" />
+                </rule>
+                <rule name="Imported Rule 2" stopProcessing="true">
+                    <match url="^.*$" />
+                    <action type="Rewrite" url="index.php" />
+                </rule>
+            </rules>
+        </rewrite>
+    </system.webServer>
+</configuration>
+]]></programlisting>
+        </sect2>
+    </sect1>
+</appendix>