<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yaf-request-abstract.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'yaf-request-abstract.setactionname.php',
    1 => 'Yaf_Request_Abstract::setActionName',
    2 => 'Set action name',
  ),
  'up' => 
  array (
    0 => 'class.yaf-request-abstract.php',
    1 => 'Yaf_Request_Abstract',
  ),
  'prev' => 
  array (
    0 => 'yaf-request-abstract.isxmlhttprequest.php',
    1 => 'Yaf_Request_Abstract::isXmlHttpRequest',
  ),
  'next' => 
  array (
    0 => 'yaf-request-abstract.setbaseuri.php',
    1 => 'Yaf_Request_Abstract::setBaseUri',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaf/yaf_request_abstract/setactionname.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf-request-abstract.setactionname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Request_Abstract::setActionName</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Request_Abstract::setActionName</span> &mdash; <span class="dc-title">Set action name</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-request-abstract.setactionname-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yaf_Request_Abstract::setActionName</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$action</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$format_name</code><span class="initializer"> = true</span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.yaf-request-abstract.php" class="type Yaf_Request_Abstract">Yaf_Request_Abstract</a></span></span></div>

  <p class="simpara">
   set action name to request, this is usually used by custom router to set route result action name.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-request-abstract.setactionname-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">action</code></dt>
    <dd>
     <p class="para">
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>, action name, it should in lower case style, like &quot;index&quot; or &quot;foo_bar&quot; 
     </p>
    </dd>
   
   
    <dt><code class="parameter">format_name</code></dt>
    <dd>
     <p class="para">
      this is introduced in Yaf 3.2.0, by default Yaf will format the name into lower case style,
      if this is set to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> , Yaf will set the original name to request.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-request-abstract.setactionname-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
   Returns the request object itself on success, or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-request-abstract.setactionname-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="methodname"><strong>Yaf_Request_Abstract::setActionName()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
</span><span style="color: #007700">class </span><span style="color: #0000BB">RestRouter </span><span style="color: #007700">extends </span><span style="color: #0000BB">Yaf_Route_Interface
</span><span style="color: #007700">{
    public function </span><span style="color: #0000BB">route</span><span style="color: #007700">(</span><span style="color: #0000BB">Yaf_Request_Abstract $request</span><span style="color: #007700">)
    {
        </span><span style="color: #FF8000">// Route any /api request to ApiController::ordersAction
        </span><span style="color: #007700">if (</span><span style="color: #0000BB">0 </span><span style="color: #007700">=== </span><span style="color: #0000BB">strpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRequestUri</span><span style="color: #007700">(), </span><span style="color: #DD0000">"/api"</span><span style="color: #007700">)) {
            </span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setControllerName</span><span style="color: #007700">(</span><span style="color: #DD0000">"Api"</span><span style="color: #007700">)
                    -&gt;</span><span style="color: #0000BB">setActionName</span><span style="color: #007700">(</span><span style="color: #DD0000">"orders"</span><span style="color: #007700">);
            return </span><span style="color: #0000BB">true</span><span style="color: #007700">;
        }

        return </span><span style="color: #0000BB">false</span><span style="color: #007700">;
    }

    public function </span><span style="color: #0000BB">assemble</span><span style="color: #007700">(array </span><span style="color: #0000BB">$info</span><span style="color: #007700">, array </span><span style="color: #0000BB">$query </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">) {}
}
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-request-abstract.setactionname-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="yaf-request-abstract.setcontrollername.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::setControllerName()</a> - Set controller name</span></li>
   <li><span class="methodname"><a href="yaf-request-abstract.setmodulename.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::setModuleName()</a> - Set module name</span></li>
   <li><span class="methodname"><a href="yaf-request-abstract.getactionname.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::getActionName()</a> - Retrieve the action name</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>