Hi again, I've finally written this rule:
$singularRules = array('/ves$/i' => '\1ve'); And it also works perfectly. Thanks again! On 21 ago, 06:03, "Dr. Loboto" <drlob...@gmail.com> wrote: > Looks like it is a bug in Inflector class. It perfectly singularize > irregular plurals alone but cannot process them correctly when string > which have other part. > > As workaround you can try split compound controller name, singularize > last part and unite them again... > > On Aug 20, 4:48 pm, jordicakephp <jordicake...@gmail.com> wrote: > > > > > Dr.Loboto, thanks a lot. :-D > > > I've tried $irregularPlural = array ('uve' => 'uves'); but it doesnt' > > work, so I'm explaining my concrete situation so that we can see where > > the error is. > > > I've programmed a generic view from wich I want to access the name of > > its associated model. If I am right, there's no field for the model's > > name in the view's information array, so I try to get this name in the > > following manner: > > > [params][models][0] or Inflector::Singularize($this->name) ($this->name is > > the controller associated to the view, in my case > > > DiccionarioUves). > > > But I allways get SedeUfe. Let's remember: my table's name's > > sede_uves, my controller's name's SedeUvesController, and, finally, my > > model's name's SedeUve. > > > On the other hand, I've experimentally accessed the model's name of my > > view with > > > $irregularPlural = array ('uve' => 'uves'); > > > and it only works if the table's name is uves. That is, if I > > undersand, this solution doesn't work for table compound names, such > > as sede_uves. What am I doing wrong? Thanks a googol! :-D > > > On 20 ago, 10:40, "Dr. Loboto" <drlob...@gmail.com> wrote: > > > > $irregularPlural = array ('uve' => 'uves'); > > > > On Aug 20, 12:10 am, jordicakephp <jordicake...@gmail.com> wrote: > > > > > Sorry... > > > > > Maybe I should have been even more specific (because of the language). > > > > My table's name is sede_uves (the compound name), my controller's name > > > > is SedeUvesController and my model's name is SedeUve. I would like to > > > > define a rule for Cake to deduce SedeUve (the name of the model) from > > > > sede_uves (the name of the table). Sorry again and thanks a lot. > > > > > On 19 ago, 19:06, jordicakephp <jordicake...@gmail.com> wrote: > > > > > > Good afternoon everybody, > > > > > > I'm trying to define a new rule of type singular-plural so that > > > > > CakePHP joins magically the table and the model names that these rule > > > > > refers to. More specifically, I go to inflections.php and write: > > > > > > $irregularPlural = array('sedeuve', 'sedeuves'); > > > > > > But this doesn't work because my table, sede_uves, is a compound noun. > > > > > I've worked before in this way, with simple nouns, and everything has > > > > > gone ok, but now, with a compound name, this doesn't work... Could > > > > > somebody give me a clue to solve this? Thanks a lot in advance! :-D- > > > > > Ocultar texto de la cita - > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > - Mostrar texto de la cita - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---