many-to-many relationship model (how to insert data ,...,)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

many-to-many relationship model (how to insert data ,...,)

mubarig
This post has NOT been accepted by the mailing list yet.
Hi to every body in the Community.

I am doing my First project with Zend Framework with version 1.12 .

i couldn't make use of the Zend Framework many-to-many relatioship design, because i am new to the Framework



Here is my many-to-many relationship model.

1. Table Houses  2.Table  customers  .
Defining the relationship.

one customer can manage one or more houses. One House can be managed by one Customer, but also One House can  have other related  customers to it, like cleaning company and etc.

House                                     customer                         --->            junctiontable       customer_house
------------                                  ---------------                                                                -------------------------------
house_id                                  customer_id                                                                house_id
address                                   address                                                                      customer_id
   .                                                   .                                                                           .
   .                                                   .                                                                           .
   .                                                   .                                                                           .

I am using zenddb gateway table

Can any one please tell me how i do populate data into the customer_hous table fom the controller. How do i get the two foreign keys of the Parent tables.
Each of the tables has it's own controller and their db tables.

class HouseObjectController extends Zend_Controller_Action
{
}
class Customer_HouseController extends Zend_Controller_Action
{
}
class CustomertController extends Zend_Controller_Action
{
}
Reply | Threaded
Open this post in threaded view
|

Re: many-to-many relationship model (how to insert data ,...,)

samsonasik
This post has NOT been accepted by the mailing list yet.
There is no many to many relationship in table relationship principle. You need to create one more table to connector, and the relationship make it one to many.

You can use referencemap and dependencetable to make it.
Reply | Threaded
Open this post in threaded view
|

Re: many-to-many relationship model (how to insert data ,...,)

mubarig
This post has NOT been accepted by the mailing list yet.
Thank you for you quick response.

I understood what you meant. But  i have already junction table, which i mean to hold the two foreign keys.

i wanted to know the implementation and how do it in the zend way, because i need to  get the 2 foreignkeys.i can get one from the URI. I have read table relationship on the zend site, but i could not implement that, i would like to see some body  show me how to implement it. Thanks in advance.