<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Zend Framework Forum - Databases</title>
		<link>http://www.zfforums.com/</link>
		<description>Zend_Db, Zend_Db_Adapter, Zend_Db_Profiler, Zend_Db_Select, Zend_Db_Table</description>
		<language>en</language>
		<lastBuildDate>Thu, 09 Sep 2010 22:32:03 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.zfforums.com/images/misc/rss.png</url>
			<title>Zend Framework Forum - Databases</title>
			<link>http://www.zfforums.com/</link>
		</image>
		<item>
			<title>Relationship of other relationship result</title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/relationship-other-relationship-result-5502.html</link>
			<pubDate>Wed, 08 Sep 2010 12:31:27 GMT</pubDate>
			<description><![CDATA[I have a main table "Order" that has depedentTables "Orderitems". And that relationship works well. 
But I also have a relationship in each order...]]></description>
			<content:encoded><![CDATA[<div>I have a main table &quot;Order&quot; that has depedentTables &quot;Orderitems&quot;. And that relationship works well.<br />
But I also have a relationship in each order item row to select Unittype from third table &quot;Set_unittypes&quot;.<br />
And I don't get how to make this last relationship work out.<br />
<br />
<br />
Order_items:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; protected $_referenceMap = array(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'orderitems' =&gt; array(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'columns' =&gt; array('parent_id'),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'refTableClass' =&gt; 'Model_DbTable_Order',<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'refColumns'&nbsp; &nbsp; &nbsp; &nbsp; =&gt; array('entity_ID')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'setunittypes' =&gt; array(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'columns' =&gt; array('unittype'),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'refTableClass' =&gt; 'Model_DbTable_SetUnittypes',<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'refColumns'&nbsp; &nbsp; &nbsp; &nbsp; =&gt; array('id')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ),&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; );</code><hr />
</div> The setunittypes as Orderitems as depedenttable.<br />
<br />
The relationship Order to Order_items work great. But I don't know how I shall connect the Order_items relationship to Unittype for each row.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $order = $this-&gt;orderService-&gt;GetOrder($get_entity_id);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;view-&gt;order = $order;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($order) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $order_items = $this-&gt;view-&gt;order-&gt;findDependentRowset('Model_DbTable_Orderitems');</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>Skatan</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/relationship-other-relationship-result-5502.html</guid>
		</item>
		<item>
			<title><![CDATA[Switching between multidb 's]]></title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/switching-between-multidb-s-5486.html</link>
			<pubDate>Wed, 01 Sep 2010 13:54:32 GMT</pubDate>
			<description><![CDATA[Hi there 
 
Pleas help :-\ 
How? & Where? do I switch between the multiple databases that I have listed in my Zend_Application config file? 
...]]></description>
			<content:encoded><![CDATA[<div>Hi there<br />
<br />
Pleas help :-\<br />
How? &amp; Where? do I switch between the multiple databases that I have listed in my Zend_Application config file?<br />
<br />
resources.multidb.db1.adapter = &quot;pdo_mysql&quot;<br />
resources.multidb.db1.host = &quot;localhost&quot;<br />
resources.multidb.db1.username = &quot;dba&quot;<br />
resources.multidb.db1.password = &quot;XXXX&quot;<br />
resources.multidb.db1.dbname = &quot;db1&quot;<br />
resources.multidb.db1.default = true<br />
 <br />
resources.multidb.db2.adapter = &quot;pdo_mysql&quot;<br />
resources.multidb.db2.host = &quot;localhost&quot;<br />
resources.multidb.db2.username = &quot;dba&quot;<br />
resources.multidb.db2.password = &quot;XXXX&quot;<br />
resources.multidb.db2.dbname = &quot;db2&quot;<br />
<br />
How? ..do I need to get them into Zend_Regisry somehow?<br />
Where? ...do I do this in my Controller? or my Model? or DB_Table_?<br />
<br />
Thank you<br />
Much Appreciated</div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>altergothen</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/switching-between-multidb-s-5486.html</guid>
		</item>
		<item>
			<title>Question about mapping objects to your database</title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/question-about-mapping-objects-your-database-5472.html</link>
			<pubDate>Thu, 26 Aug 2010 18:18:38 GMT</pubDate>
			<description>Let say I have the following objects 
Employee (id, name, type, email, department) 
Department (id, name, building) 
 
I have the following tables...</description>
			<content:encoded><![CDATA[<div>Let say I have the following objects<br />
Employee (id, name, type, email, department)<br />
Department (id, name, building)<br />
<br />
I have the following tables storing the info<br />
employee (id-int, type-int, email-varchar, department-int)<br />
type (id-int, name-varchar) - lookup table<br />
department (id-int, name-building, building-int)<br />
building (id-int, name-varchar) - lookup table<br />
<br />
I would create a domain model for each object(Employee, Department)<br />
<br />
I would create a DbTable for each table (DbTable_Employee, DbTable_Department)<br />
First Question: should I create a DbTable for the lookup tables?<br />
<br />
Second Question: how should the objectMapper join the data from the different tables?<br />
<br />
<br />
Thanks</div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>Jay59</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/question-about-mapping-objects-your-database-5472.html</guid>
		</item>
		<item>
			<title>Please Help : : Zend_Db_Table_Row_Exception Error</title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/please-help-zend_db_table_row_exception-error-5329.html</link>
			<pubDate>Sat, 21 Aug 2010 19:21:33 GMT</pubDate>
			<description>Hi.. 
 
I am a novice PHP programmer and I have no knowledge of the Zend Framework. I run website on a social networking PHP script (based on Zend...</description>
			<content:encoded><![CDATA[<div>Hi..<br />
<br />
I am a novice PHP programmer and I have no knowledge of the Zend Framework. I run website on a social networking PHP script (based on Zend Framework) called Social Engine. But I have started getting an error after I installed a third party plugin which enables users to manage music on their profiles. And I am not getting proper service from the plugin developer, so I have come to you guys for help. <br />
<br />
I am hereby posting the data from the error log. I know it might be impossible to suggest a solution from viewing an error log alone. But if you direct me in some way, or atleast let me know where to start looking for problems, I would be really really grateful.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Quote:</div>
	<div class="bbcode_quote printable">
		<hr />
		
			exception 'Zend_Db_Table_Row_Exception' with message 'Specified column &quot;isdownload&quot; is not in the row' in /home/mysite/public_html/application/libraries/Zend/Db/Table/Row/Abstract.php:197<br />
Stack trace:<br />
#0 /home/mysite/public_html/application/modules/Music/Form/CreateAlbum.php(203): Zend_Db_Table_Row_Abstract-&gt;__set('isdownload', '1')<br />
#1 /home/mysite/public_html/application/modules/Music/controllers/AlbumController.php(45): Music_Form_CreateAlbum-&gt;saveValues()<br />
#2 /home/mysite/public_html/application/libraries/Zend/Controller/Action.php(513): Music_AlbumController-&gt;createAction()<br />
#3 /home/mysite/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action-&gt;dispatch('createAction')<br />
#4 /home/mysite/public_html/application/libraries/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))<br />
#5 /home/mysite/public_html/application/modules/Core/Bootstrap.php(67): Zend_Controller_Front-&gt;dispatch()<br />
#6 /home/mysite/public_html/application/libraries/Engine/Application.php(99): Core_Bootstrap-&gt;run()<br />
#7 /home/mysite/public_html/application/index.php(173): Engine_Application-&gt;run()<br />
#8 /home/mysite/public_html/index.php(15): include('/home/mysite/...')<br />
#9 {main}
			
		<hr />
	</div>
</div> If you need any more info, or screenshots, I will b happy to provide..<br />
<br />
Hopefully..<br />
Thanks.</div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>punarnava</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/please-help-zend_db_table_row_exception-error-5329.html</guid>
		</item>
		<item>
			<title>Issues with Sub Queries in ZF</title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/issues-sub-queries-zf-5303.html</link>
			<pubDate>Sun, 15 Aug 2010 05:12:50 GMT</pubDate>
			<description>Hey guys, 
 
Just a quick one, im trying to perform a sub query inside a left join statement anyone shed any light on this? 
 
		 
---Quote---...</description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
Just a quick one, im trying to perform a sub query inside a left join statement anyone shed any light on this?<br />
<br />
		<div class="bbcode_container">
	<div class="bbcode_description">Quote:</div>
	<div class="bbcode_quote printable">
		<hr />
		
				INNER JOIN <br />
				(SELECT MAX(rvId) AS id FROM recentlyviewed WHERE<br />
				rvSessionid = 'qb52hgec8hcd44glu2hp4d8h44' group by rvProductid) idSort <br />
			ON <br />
				recentlyviewed.rvId = idSort.id
			
		<hr />
	</div>
</div> ive converted most of the code to zf syntax already... just this is stumped me.</div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>slyvampy</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/issues-sub-queries-zf-5303.html</guid>
		</item>
		<item>
			<title>Strange ID problem with Zend_Db_Select joining 3 tables</title>
			<link>http://www.zfforums.com/zend-framework-components-13/databases-20/strange-id-problem-zend_db_select-joining-3-tables-5300.html</link>
			<pubDate>Fri, 13 Aug 2010 09:42:42 GMT</pubDate>
			<description><![CDATA[Can anyone help me work out why I'm not able to extract the classes.id data in the following Zend_Db_Select join query.   
 
I need the class id to...]]></description>
			<content:encoded><![CDATA[<div>Can anyone help me work out why I'm not able to extract the classes.id data in the following Zend_Db_Select join query.  <br />
<br />
I need the class id to allow me to include an 'edit class' link.  Problem is the query is outputting an id for each class which is different to classes.id in the database table.<br />
<br />
What am I doing wrong?<br />
<br />
I have three tables: classes, teacher and day whose structure is as follows:<br />
<br />
<u>classes</u><br />
<b>id</b> [primary key a/i]<br />
<b>classname</b> [varchar]<br />
<b>duration</b> [int]<br />
<b>time</b> [time]<br />
<b>teacher_id</b> [int]<br />
<b>day_id</b> [int]<br />
<br />
<u>teacher </u><br />
<b>id</b> [primary key a/i]<br />
<b>firstname</b> [varchar]<br />
<b>lastname</b> [varchar]<br />
<br />
<u>day</u><br />
<b>id</b> [primary key a/i]<br />
<b>dayname</b> [varchar]<br />
<br />
I have written the following Zend_Db_Select query to join the tables:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">public function listteacherClass()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $db = Zend_Registry::get('db');<br />
&nbsp; &nbsp; &nbsp; &nbsp; $select = new Zend_Db_Select($db);<br />
&nbsp; &nbsp; &nbsp; &nbsp; $statement = $select-&gt;from(array('t' =&gt; 'teacher'),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array('c.classname', 'c.duration', 'c.time', 'c.id', 't.firstname', 't.lastname', 'd.dayname'))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;join(array('c' =&gt; 'classes'), 'c.teacher_id = t.id')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;join(array('d' =&gt; 'day'), 'c.day_id = d.id')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;order(array('d.id ASC', 'c.time ASC'));<br />
&nbsp; &nbsp; &nbsp; &nbsp; $results = $db-&gt;query($statement);<br />
&nbsp; &nbsp; &nbsp; &nbsp; $rows = $results-&gt;fetchAll();<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $rows;<br />
&nbsp; &nbsp; }</code><hr />
</div> This query lists the teacher, days and classes data from the three database tables correctly in an array, but ...<br />
<br />
It doesn't pull the classes.id data from the classes table.  The classes.id it outputs is the same as the day.id data. <br />
<br />
If I restrict the above to one join on the teacher and classes tables, then the correct classes.id appears in the array.  <br />
<br />
Is there something wrong with the syntax of my query that is creating this problem?<br />
<br />
Many thanks for any help.  This one's tearing my hair out!</div>

 ]]></content:encoded>
			<category domain="http://www.zfforums.com/zend-framework-components-13/databases-20/">Databases</category>
			<dc:creator>beatificboy</dc:creator>
			<guid isPermaLink="true">http://www.zfforums.com/zend-framework-components-13/databases-20/strange-id-problem-zend_db_select-joining-3-tables-5300.html</guid>
		</item>
	</channel>
</rss>
