Update User Guide

This commit is contained in:
kenjis 2023-11-06 21:53:26 +00:00
parent c697ab65a1
commit ef96e17c3c
2 changed files with 4 additions and 3 deletions

View File

@ -708,7 +708,7 @@ to remove the typehint.</p>
<span class="p">]);</span>
</pre></div>
</div>
<div class="admonition note" id="validation-withrequest">
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code class="docutils literal notranslate"><span class="pre">setRules()</span></code> will overwrite any rules that were set previously. To add more than one
rule to an existing set of rules, use <code class="docutils literal notranslate"><span class="pre">setRule()</span></code> multiple times.</p>
@ -776,7 +776,7 @@ For example, data returned by multi select dropdown:</p>
</div>
</section>
<section id="withrequest">
<h3><a class="toc-backref" href="#id20">withRequest()</a><a class="headerlink" href="#withrequest" title="Permalink to this headline"></a></h3>
<span id="validation-withrequest"></span><h3><a class="toc-backref" href="#id20">withRequest()</a><a class="headerlink" href="#withrequest" title="Permalink to this headline"></a></h3>
<p>One of the most common times you will use the validation library is when validating
data that was input from an HTTP Request. If desired, you can pass an instance of the
current Request object and it will take all of the input data and set it as the
@ -785,7 +785,8 @@ data to be validated:</p>
<span class="nv">$request</span> <span class="o">=</span> <span class="nx">\Config\Services</span><span class="o">::</span><span class="na">request</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$validation</span><span class="o">-&gt;</span><span class="na">withRequest</span><span class="p">(</span><span class="nv">$request</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">run</span><span class="p">())</span> <span class="p">{</span>
<span class="c1">// If you want to get the validated data.</span>
<span class="c1">// If you use the input data, you should get it from the getValidated() method.</span>
<span class="c1">// Otherwise you may create a vulnerability.</span>
<span class="nv">$validData</span> <span class="o">=</span> <span class="nv">$validation</span><span class="o">-&gt;</span><span class="na">getValidated</span><span class="p">();</span>
<span class="c1">// ...</span>

Binary file not shown.