cake-php@googlegroups.com
[Top] [All Lists]

Re: naming Model

Subject: Re: naming Model
From: euromark
Date: Sat, 9 Apr 2011 00:44:18 -0700 PDT
well, you can always override the default behavior
I - for example - have a contact model as well as a contact controller
because it would make no sense to call it "contacts" :)

the conventions are useful for most cases, in same you can easily
adjust the classes manually
to get the desired result (even with some pluralization problems -
this can even happen in English itself).


On 9 Apr., 02:46, Benno <benno.dir...@xxxxxxxxx> wrote:
> Imagine your native language, say, Japanese, doesn't inflect for
> pluralization. Now imagine you're using a framework that does. While
> I'm not going to suggest that 5 months is now reasonable for getting
> some basic functionality going, it seems totally reasonable to me that
> 5 months later you still don't understand intuitively why some things
> are singular and some things are plural.
>
> On Apr 9, 8:18 am, euromark <dereurom...@xxxxxxxxxxxxxx> wrote:
>
>
>
>
>
>
>
> > seriously? you have been using cake for 5 months now?
> > you did not yet get the console working or understood the most basic
> > principles as outlined in the cookbook?
> > ähm.. i am speechless
>
> > On 9 Apr., 02:08, cricket <zijn.digi...@xxxxxxxxx> wrote:
>
> > > On Fri, Apr 8, 2011 at 7:55 PM, cake-learner <sh.koiz...@xxxxxxxxx> wrote:
> > > > I have following Controller and Model set up manually since the baker
> > > > is not so easy to use.
> > > > But somehow I can't get to work. First of all, about the class name, I
> > > > am not sure why they want to use singular for model and plural for
> > > > controller
>
> > > A model represents a single entity. So, singular. A controller handles
> > > collections of entities (in a sense). So, plural.
>
> > > > and small letters for routes.php. It's been nightmare with cakephp
> > > > project for last 5 months.
>
> > > > class TemplatesController extends AppController {
> > > >  $name = "Templates";
> > > >  function index(){
> > > >  }
> > > > }
>
> > > If you're using PHP 5.x you can leave out $name here.
>
> > > > class Template extends exends Model{
> > > >  $name = "Template";
> > > > }
>
> > > Typo? And it's AppModel.
>
> > > class Template extends AppModel
>
> > > Ditto about $name here.
>
> > > > Router::connect('/template_page/:id',array('controller'=>templates',
> > > > 'action' => 'index',  'client'=>$domains[0]) );
>
> > > I don't understand what $domains is so no comment.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php

<Prev in Thread] Current Thread [Next in Thread>