Monday, September 27, 2010

Re: "Pages" database table

Hi LipeDjow,

thanks for your advice and example, that sounds like most suitable
solution (also suggestion of j.blotus) in such situations.

Ladislav

On Sep 25, 9:33 pm, Felipe Tadeu <liped...@gmail.com> wrote:
> Hi Ladislav,
>
> I had a similar problem, but in my case the table was called 'files'.
> My simple solution was to keep the table name, and change the name at
> application.
> i.e: table name as 'pages' and controller/model names as
> BookPagesController/BookPage (following the suggestion of j.blotus).
>
> At the model just need to set $useTable = 'pages'.
>
> class BookPage extends AppModel {
>
>     var $name = 'BookPage';
>     var $useTable = 'pages';
>
> }
>
> I don't like the idea to refactor the pages controller just to satisfy
> one module name.
>
> Hope that helps. =)
>
> PS: sorry for my bad english.
>
> LipeDjow
>
> On 24 set, 17:51, lado77 <rockl...@gmail.com> wrote:
>
>
>
> > Dear Cake Bakers,
>
> > In my app (currently being designed) I want to have "pages" database
> > table, simply because it is the most suitable name for it (Page
> > belongsTo Book, Book hasMany Pages). But this is of course in conflict
> > with Cake's default static content serving with its PagesController. I
> > really don't want to mix database entity "Page" with static content
> > "Page" into the common "PageController" as these 2 are totally
> > different things. So I see 2 possible solutions here. One would be to
> > rename(refactor) cake's PagesControler to something like
> > StaticController and all occurrences in URL from /pages/ to /static/.
> > But this seems to me quite stupid e.g. regarding future Cake's release
> > updates. Another solution would be to rename "Pages" table to
> > something different. But I don't like to complicate obvious and easy
> > things such as clear naming conventions. My question is: Have anybody
> > had experiences with such situation and what was your solution?
>
> > Ladislav

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: