This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » How to arrange data from multiple tables
How to arrange data from multiple tables [message #97764] Wed, 21 April 2010 14:18 Go to next message
alxkn  is currently offline alxkn
Messages: 126
Registered: June 2007
Senior Member
Hello,

I have multiple tables each with created_at field. I need to retrieve data from all of them and display them arranged according to time they were created. This is something like in facebook.com's status page.

Thanks in advance.
A.


http://fmpsv.com/ --revolution in social networking
Re: How to arrange data from multiple tables [message #97768 is a reply to message #97764 ] Wed, 21 April 2010 14:34 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
I'd create a database view that joins them together using UNION, and then add the view into the schema so it can be paged in the normal way. So if you use Propel, you can use sfPropelPager with the view, and just treat it as read-only.


Remember Palestine
Re: How to arrange data from multiple tables [message #97780 is a reply to message #97764 ] Wed, 21 April 2010 15:43 Go to previous messageGo to next message
alxkn  is currently offline alxkn
Messages: 126
Registered: June 2007
Senior Member
Thanks halfer.

I use propel and mysql. Is there any links on how to add a view to schema?

A.


http://fmpsv.com/ --revolution in social networking
Re: How to arrange data from multiple tables [message #97902 is a reply to message #97764 ] Thu, 22 April 2010 20:57 Go to previous messageGo to next message
alxkn  is currently offline alxkn
Messages: 126
Registered: June 2007
Senior Member
I have followed this link
http://forum.symfony-project.org/index.php/m/71189/

and used UNION to create a view. However, the id filed that comes from both tables can have the same values, but symfony considers it as a primary_key. Tried to rename id field, but then symfony adds id fiels in base classes which again causes errors.

Is there anyway to solve this issue in symfony?

Thanks in advance.
A.


http://fmpsv.com/ --revolution in social networking
Re: How to arrange data from multiple tables [message #97937 is a reply to message #97764 ] Fri, 23 April 2010 13:21 Go to previous message
alxkn  is currently offline alxkn
Messages: 126
Registered: June 2007
Senior Member
putting these attributes
_attributes: { idMethod: none, defaultIdMethod: none, readOnly: true}

does not help. Symfony creates additional id filed if primary_key is not present.


http://fmpsv.com/ --revolution in social networking
Previous Topic:Security.yml and Filters
Next Topic:Maybe my session doesn't work
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software