473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Zend_Db_Table_Abstract Joining tables

bilibytes
128 100+
Hi there,

I am wondering if there is a possibility to declare a Model_DbTable_Table1JoinedToTable2ToTable3... class

It would be convenient to create compound table from several tables joined from a foreign key.

Lets say we have:

tables:
Expand|Select|Wrap|Line Numbers
  1. -------------------------------------------
  2. users
  3. ------------------------------------------
  4. id | name | password | email
  5.  
,
Expand|Select|Wrap|Line Numbers
  1. -----------------------------------------
  2. users_info
  3. -----------------------------------------
  4. id | user_id | location_id | description | age | ...
  5.  
,
Expand|Select|Wrap|Line Numbers
  1. -------------------------------------------
  2. locations
  3. ------------------------------------------
  4. id | name | country_id
  5.  
and
Expand|Select|Wrap|Line Numbers
  1. -------------------------------------------
  2. countries
  3. ------------------------------------------
  4. id | name
  5.  
where:
-users_info.user_id would be a foreign key to users.id
-users_info.location_id would be a foreign key to locations.id
-location.country_id would be a foreign key to countries.id

sometimes it would be convenient to just query the users table because it is lighter than all joined (i.e. Login) and in other cases it would be great to have all joined (i.e view user profile)

Zend Framework tells to declare a DbTable class for each table in the database, so there would be:
1. Model_DbTable_Users
2. Model_DbTable_UsersInfo
3. Model_DbTable_Locations
4. Model_DbTable_Countries

and i would like to add a 5th that would join all these tables together, and then be able to query the master table:

5 Model_DbTable_Virtual_UsersProfileInfo

the table would not phisically exist but would be dynamically created by modifying the query which would be a join + the query


now the big questions:
Is there a way to perform this in the Zend Framework

Is this a good approach of the problem?

Is there a better way?


thank you very much,

cheers!

bilibytes
May 10 '09 #1
0 1683

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Job Lot | last post by:
Is there anyway of Joining two or more DataTable with similar structure? I have three DataTables with following structures Data, AmountB/F, Repayments, InterestCharged and AmountC/F i want...
2
by: James | last post by:
Can anyone please shed some light on the following... I have a framework that uses dynamically created tables, named using an incremental "attribute set ID", as follows: attrdata_1 attrdata_2...
3
by: james | last post by:
Hi, I would like to get all the records from 9 tables that have the same field value in one field (it is a unique field)that is shared by all the tables. Would this method of joining work: ...
1
by: Brian | last post by:
I need help joining info from two tables. Table1 and Table 2 have the same fields(Node,Card,Slot,Facility,Sub-Port,Channel,Group,Cic) Group is text, rest are number. Table 1 contains records for...
2
by: Coquette | last post by:
Hi all. I'm new here. I wanted to ask your opinion about *joining two tables* from *two different database* together. Is *that* possible? My project requires me to join identical tables from...
3
by: Reader | last post by:
Hello all, I am joining two tables in a query and the output should be all those records where two fields in table1 match two corresponding fields in table2. I joined the tables using both...
2
by: nkechifesie | last post by:
I have created 9 tables in access via visdata and need to create another table joining all these tables. I have used the query in visdata to do this but it gives me an outrageous view. I have entered...
4
by: Rnt6872 | last post by:
Table A Table B BOL# B_BOL# Chargeback# Hi All, I have been struggling with this for...
2
by: Supermansteel | last post by:
I am joining these 2 tables together in Access 2003 and can't figure out the exact way of writing this script......Can anyone help? I have the following SQL: SELECT...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.