If you cannot alter db structure, that's fine. Cake works perfectly
well with legacy DB's, but you have to ensure that you specify any
settings that do not follow conventions. That includes table names,
primary keys as well as foreign keys.

You didn't provide your model definitions, so it's hard to guess as to
what could be culprit.

On Oct 18, 7:45 am, Marritza <[EMAIL PROTECTED]> wrote:
> Forgot to mention - I am using $prmaryKey syntax in each model, because I
> have limited possibilities to alter the db structure. Tho, it is possible
> for me to create a sample table using cake conventions, I'll try again then.
>
>
>
> teknoid-3 wrote:
>
> > You shouldn't break conventions when naming your primary keys.
> > Cake will expect your primary key to be named 'id'... So Design.id and
> > Status.id.
>
> > Of course you can override those by setting a $prmaryKey = 'myOwnKey';
> > in the model, but why make your life more difficult?
>
> > On Oct 17, 8:17 pm, Marritza <[EMAIL PROTECTED]> wrote:
> >> Hello!
>
> >> I'm using Cake for several days now, I'm still under big impression of
> >> its
> >> capabilities.
>
> >> Nevertheless, I have faced a problem, to which solution, which I have
> >> found,
> >> feels not logical in the Cake ways of doing things. First, let me show
> >> you
> >> my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch).
>
> >> table DESIGNS
> >> designs_id serial <- primary key
> >> job_name
> >> status_id
> >> ...etc
>
> >> table STATUS
> >> status_id serial <- primary key
> >> name
>
> >> The expected outcome is simple - I'm querying the Design model to
> >> retrieve
> >> data about a job, and I expect to see the status name which is related
> >> thru
> >> Design.status_id => Status.status_id.
>
> >> Now, when I tried to accomplish it with $hasOne in the Design model the
> >> result is that Status is joined not on the forementioned basis, but on
> >> Design.design_id -> Status.status_id.
>
> >> to my surprise, it works using $belongsTo relation.
>
> >> Perhaps there is something wrong with my understanding of the Cake
> >> relation
> >> ways, perhaps I'm simply overlooking some basic stuff.
>
> >> Anyhow, any help greatly appreciated.
>
> >> --
> >> View this message in
> >> context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
> >> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> View this message in 
> context:http://www.nabble.com/Newbie-questions-about-model-relations-tp200418...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to