<?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.setdispatched.php',
    1 => 'Yaf_Request_Abstract::setDispatched',
    2 => 'Mark the request as dispatched',
  ),
  'up' => 
  array (
    0 => 'class.yaf-request-abstract.php',
    1 => 'Yaf_Request_Abstract',
  ),
  'prev' => 
  array (
    0 => 'yaf-request-abstract.setcontrollername.php',
    1 => 'Yaf_Request_Abstract::setControllerName',
  ),
  'next' => 
  array (
    0 => 'yaf-request-abstract.setmodulename.php',
    1 => 'Yaf_Request_Abstract::setModuleName',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yaf/yaf_request_abstract/setdispatched.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf-request-abstract.setdispatched" class="refentry">
 <div class="refnamediv">
<h1 class="refname">Yaf_Request_Abstract::setDispatched</h1>
<p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Request_Abstract::setDispatched</span> &mdash; <span class="dc-title">Mark the request as dispatched</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-request-abstract.setdispatched-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yaf_Request_Abstract::setDispatched</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$flag</code><span class="initializer"> = true</span></span>): <span class="type"><a href="class.yaf-request-abstract.php" class="type Yaf_Request_Abstract">Yaf_Request_Abstract</a></span></div>

  <p class="simpara">Mark the request as dispatched</p>
  <p class="simpara">This is called by the dispatcher after an action is executed; it stops the dispatch loop. It can be called manually, e.g. to skip the remaining dispatch iterations.</p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-request-abstract.setdispatched-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">flag</code></dt>
    <dd>
<p class="simpara">The state to set. Defaults to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.</p>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-yaf-request-abstract.setdispatched-returnvalues">
  <h3 class="title">Return Values</h3>
<p class="simpara">Returns the request object itself.</p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-request-abstract.setdispatched-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="methodname"><strong>Yaf_Request_Abstract::setDispatched()</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">AuthPlugin </span><span style="color: #007700">extends </span><span style="color: #0000BB">Yaf_Plugin_Abstract
</span><span style="color: #007700">{
    public function </span><span style="color: #0000BB">preDispatch</span><span style="color: #007700">(</span><span style="color: #0000BB">Yaf_Request_Abstract $request</span><span style="color: #007700">, </span><span style="color: #0000BB">Yaf_Response_Abstract $response</span><span style="color: #007700">)
    {
        if (empty(</span><span style="color: #0000BB">$_SESSION</span><span style="color: #007700">[</span><span style="color: #DD0000">"user_id"</span><span style="color: #007700">])) {
            </span><span style="color: #FF8000">// Skip the requested action and redirect to the login page
            </span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setDispatched</span><span style="color: #007700">();
            </span><span style="color: #0000BB">$response</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRedirect</span><span style="color: #007700">(</span><span style="color: #DD0000">"/account/login"</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.setdispatched-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="yaf-request-abstract.isdispatched.php" class="methodname" rel="rdfs-seeAlso">Yaf_Request_Abstract::isDispatched()</a> - Determine if the request is dispatched</span></li>
   <li><span class="methodname"><a href="yaf-dispatcher.dispatch.php" class="methodname" rel="rdfs-seeAlso">Yaf_Dispatcher::dispatch()</a> - Dispatch a request</span></li>
  </ul>
 </div>

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