title: October CMS Models - Overwrite save function
body: <p>Good day,</p>
  
  <p>I overwrote the save function of my October CMS model.</p>
  
  <pre><code> public function save(Array $options=[])
  </code></pre>
  
  <p>When I tried to save, it threw an error.</p>
  
  <blockquote>
    <p>Declaration of MyCompany\MyPlugin\Models\MyModel::save(array $options = Array) should be compatible with October\Rain\Database\Model::save(array $options = NULL, $sessionKey = NULL)" on line 42 of /a/b/c/d/mysite/plugins/mycompany/myplugin/models/MyModel.php</p>
  </blockquote>
  
  <p>So I modified the save function.</p>
  
  <pre><code>public function save(Array $options=[], $sessionKey=null)
  </code></pre>
  
  <p>Then I get this confusing error.</p>
  
  <blockquote>
    <p>Type error: Argument 1 passed to MyCompany\MyPlugin\Models\MyModel::save() must be of the type array, null given, called in /a/b/c/d/mysite/modules/backend/behaviors/FormController.php on line 251" on line 38 of /a/b/c/d/mysite/plugins/mycompany/myplugin/models/MyModel.php</p>
  </blockquote>
  
  <p>So, if it's passing a null there, how are models saving, considering the class inheritance forces argument 1 to be an array?</p>
  
  <p>Edit: Here is line 251 of /a/b/c/d/mysite/modules/backend/behaviors/FormController.php</p>
  
  <pre><code>$modelToSave-&gt;save(null, $this-&gt;formWidget-&gt;getSessionKey());
  </code></pre>
  
  <p>So the base class will accept nulls, even if type hinting requires Array, but upon overwriting the function, nulls are no longer accepted?</p>