Override default pluralization

florian | 11 months ago

Hi!
I saw that right now that pluralization of model names simply add a 's' to the model name. Is there a way to manually provide the plural form of the model way? I would like to provide 'Entries' as the plural form for my Entry-model.

Thanks!

@Kris: Keep up the good work!



midnightmonster | 11 months ago

For a model class you can use the !Table annotation to specify the name of the table. E.g.:

!Table Entries

And then if something else HasMany entries, you can do

!HasMany entries, Class: Entry

...and I think that's all the places it would be used in plural?

reply

florian | 11 months ago

Thank for your reply.

I made the changes you suggested. But now in the view where i call the $user->entries() method, I get the following error: "Entrie has not been imported.".
I guess the reason is, recess uses the toSingular() method on 'entries' to get the model name, which results in 'Entrie'.

Any suggestions?
Thanks!

reply



Welcome KrisJordan!

Web: http://www.krisjordan.com/

Location: North Carolina

Edit Profile