Note that there are some explanatory texts on larger screens.

plurals
  1. PODefine a singular rule in the bootstrap for Inflector
    text
    copied!<p>I'm using CakePHP 2.1 and need to define an Inflector rule for the word "Software", because CakePHP is converting all references to the plural form "Softwares" which isn't correct. Cake is looking for SoftwaresController and a table named Softwares.</p> <p>I do know to create the rule in the boot strap, and read this doc reference.</p> <p><a href="http://book.cakephp.org/2.0/en/development/configuration.html#inflection-configuration" rel="noreferrer">http://book.cakephp.org/2.0/en/development/configuration.html#inflection-configuration</a></p> <p>I also took a look at the lib/Cake/Inflector.php file, but can't figure out the syntax for defining a rule. It looks kind of like regex. Here are a few rule examples.</p> <pre><code> '/(s)tatus$/i' =&gt; '\1\2tatuses', '/(quiz)$/i' =&gt; '\1zes', '/^(ox)$/i' =&gt; '\1\2en', '/([m|l])ouse$/i' =&gt; '\1ice', '/(matr|vert|ind)(ix|ex)$/i' =&gt; '\1ices', '/(x|ch|ss|sh)$/i' =&gt; '\1es', </code></pre> <p>What would be the correct code to define a Software singular Inflector rule?</p> <p><strong>EDIT:</strong></p> <pre><code> Inflector::rules('singular', array('rules'=&gt;array('/software/'=&gt;'software'),'irregular'=&gt;array('software'=&gt;'software'),'uninflected'=&gt;array('software'))); </code></pre> <p>I tried adding this rule, which works for the SoftwareController but Cake is complaining that it can't find the Softwares table, which is actually named "Software". I feel I'm close, but still missing something about how this works.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload