title: How I do do get session in model? CakePHP 3.x
body: <h2>Cakephp 3.x</h2>
  
  <p>I want to do my captcha custom validation. But I can not access a session.</p>
  
  <pre><code>$validator-&gt;notEmpty('securityCode', __('not empty message'))
      -&gt;add('securityCode','custom', 
          ['rule' =&gt; function ($value, $context) use ($extra) {
              if($this-&gt;request-&gt;Session()-&gt;read('captcha') != $value) {
                  return false;
              }
              return true;
          }, 'message' =&gt; 'error security code']);
   return $validator;
  </code></pre>
  
  <p>or can I my custom validation function give custom parameter?</p>
  
  <pre><code>public function validationLogin(Validator $validator, $customParameter)
  { //bla bla }
  </code></pre>
  
  <p>I use: <a href="http://book.cakephp.org/3.0/en/core-libraries/validation.html#custom-validation-rules" rel="noreferrer">http://book.cakephp.org/3.0/en/core-libraries/validation.html#custom-validation-rules</a></p>