Sunday, February 28, 2010

Re: Auto create new entry in database wenn model is saved

Hi Alex,

What does your datamodel look like? Based on your information I assume
you have the following models and associations/relationships:

User hasOne/belongsTo Car
Car belongsTo/hasMany Carmodel
Car belongsTo/hasMany Attribute
Car belongsTo/hasMany Misc

That means that one User may have one Car.
Each Car may be described by Carmodel, Attribute and Misc.

Do I understand your situation correctly?
Enjoy,
John

On Feb 28, 7:42 pm, alex bailey <v...@planet-generals.de> wrote:
> Hi folks,
>
> I recently started using cakephp for one of my projects and I already
> really like it, now I have a problem which I worked on for a while but
> couldnt solve it yet...
>
> Lets say I have a User model and a user has a related table like Car:
>
> User 1 -- 1 Car
>
> Now by using a Form I want to save the user and the car to the
> database but now comes my problem:
>
> Car also has relations to 3 other tables which must be also created
> when a new car is created for example:
>
>                            1 Carmodel table
> User1 -- 1 Car -- 1Attribute table
>                            1 Misc table
>
> Is there a way I can also create those 3 related tables for car when I
> save User and Car?
>
> Thanks in advance
>
> regards
>
> Alex

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: