开发者

CakePHP problem with inflections

开发者 https://www.devze.com 2023-03-17 08:18 出处:网络
I have problem with inflections. I created a model SentSms and a controller for it called SentSmsesCon开发者_如何学JAVAtroller.

I have problem with inflections. I created a model SentSms and a controller for it called SentSmsesCon开发者_如何学JAVAtroller. It doesn't work properly so I've tried use Inflector::rules

Inflector::rules('plural', array(
    'rules' => array('/^(sms)$/i' => '\1es'),
    'irregular' => array('sms' => 'smses')
));

Inflector::rules('singular', array(
    'rules' => array('/^(sms)es$/i' => '\1'),
    'irregular' => array('smses' => 'sms')
));

But it did not help.


I'm not too familiar with custom inflections, but looks like your rules look for an exact match of "sms". Since your model is called "SentSms" it'll never match the custom rules. Try removing the ^ character (start of line) from the regex or use the full name of your model.

0

精彩评论

暂无评论...
验证码 换一张
取 消