Have you defined your tables in accordance with CakePHP standards?
That is, using your tables as an example:
users (id, username, password, other columns, created)
users_phones(id, user_id, phoneno, created) where user_id is the
foreign key to user.
users_addresses_details(id, address_id, fieldtype, fieldvalue)
users_addresses(id, user_id, streetname, houseno, other columns,
created)
If you are using the CakePHP standards, then you usually should be
able to define the relationships/associations in the models as
follows:
User hasMany (UserAddress, UserPhone)
UserAddress hasMany (UserAddressDetail)
UserAddress belongsTo (User)
UserPhone belongsTo (User)
UserAddressDetail belongsTo (UserAddress)
But the error you mentioned, seems more like that the URL is wrong,
not having anything to do with the models/tables. Maybe I am
misunderstanding what you say :)
John
On Dec 2, 8:30 am, anand angadi <anuang...@gmail.com> wrote:
> hi john,
>
> Sorry for incomplete requirement.
>
> Answers for ur questions.
>
> 1>I am registring new user.Here I am inserting in to 4 table.
>
> 2> In model I am using hasMany as below...here table are...
> user,user_phone,user_address_details,
> var $hasMany = array(
> 'user_phone' => array(
> 'className' => 'user_phone',
> 'foreignKey' => 'id',
> 'conditions' => array('user_phone.id' => '>0'),
> 'dependent'=> true),
> 'user_address_details'=>array(
> 'className' => 'user_address_details','foreignKey' =>
> 'address')
> );
>
> but I want to insert in to user_address as wel. so I modified my code as...
> var $hasMany = array(
> 'user_phone' => array(
> 'className' => 'user_phone',
> 'foreignKey' => 'id',
> 'conditions' => array('user_phone.id' => '>0'),
> 'dependent'=> true),
> 'user_address_details'=>array(
> 'className' => 'user_address_details','foreignKey' =>
> 'address'),
> * 'user_address'=>array(
> 'className' => 'user_address_details','foreignKey' => 'id')*
> );
> for this am getting error as bello point...
>
> 3>
> Not Found
>
> *Error: * The requested address *'/'* was not found on this server.
>
> this is the actual problem...
>
> Thanks:
>
> Anand
>
> On Wed, Dec 2, 2009 at 11:47 AM, John Andersen <j.andersen...@gmail.com>wrote:
>
> > Please specify:
> > 1) What you are trying to do within the CakePHP framework.
> > 2) Show the code (partly) that you are trying to use/develop.
> > 3) Show the result/errors that you receive doing you work.
>
> > Then we will better be able to assist you ;)
> > Enjoy,
> > John
>
> > On Dec 2, 7:25 am, anand angadi <anuang...@gmail.com> wrote:
> > > Hi All,
>
> > > I am cakephp learner...Am not able to insert more than 3 tables...
>
> > > Please help me on this...
>
> > > Thanks:
> > > Anand
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
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:
Post a Comment