<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Basic Model Edits in Yii</title> <atom:link href="http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/feed/" rel="self" type="application/rss+xml" /><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/</link> <description>Translating Geek Into English</description> <lastBuildDate>Thu, 17 May 2012 00:26:37 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>By: Larry</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-27715</link> <dc:creator>Larry</dc:creator> <pubDate>Wed, 02 May 2012 00:52:05 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-27715</guid> <description>Thanks for the nice words. If I understand your question, you could edit the template that Yii uses to auto-generate the code so that the IDs aren&#039;t shown.</description> <content:encoded><![CDATA[<p>Thanks for the nice words. If I understand your question, you could edit the template that Yii uses to auto-generate the code so that the IDs aren&#8217;t shown.</p> ]]></content:encoded> </item> <item><title>By: Larry</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-27695</link> <dc:creator>Larry</dc:creator> <pubDate>Tue, 01 May 2012 20:53:23 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-27695</guid> <description>Hello Sean. Thanks for the nice words. As for why use &quot;departmentId&quot; in both cases, in Employee, the relation points to the departmentId PK in Department. In Department, the relation points to the departmentId FK in Employee.</description> <content:encoded><![CDATA[<p>Hello Sean. Thanks for the nice words. As for why use &#8220;departmentId&#8221; in both cases, in Employee, the relation points to the departmentId PK in Department. In Department, the relation points to the departmentId FK in Employee.</p> ]]></content:encoded> </item> <item><title>By: Sean B</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-27473</link> <dc:creator>Sean B</dc:creator> <pubDate>Sat, 28 Apr 2012 05:37:22 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-27473</guid> <description>Hi Larry, I first want to say thank you for your tutorials and posts.  I know you hinted at the answer for my following set of questions, but I would like to understand it more technically.
The question revolves around the Employee&#039;s and Department&#039;s model relations method:
Employee Model
public function relations()
{
return array(&#039;department&#039; =&gt; array(self::BELONGS_TO, &#039;Department&#039;, &#039;departmentId&#039;) );
}
Department Model
public function relations()
{
return array(&#039;employees&#039; =&gt; array(self::HAS_MANY, &#039;Employee&#039;, &#039;departmentId&#039;) );
}
Why do both models use departmentId as the foreign key(Yii Doc Relational Active Record/declaring relations) when the foreign key exists in only the employee schema?
I have put a bit of what I believe is going on, and please correct me if I am wrong:Employee Model
Employee belongs to at most one department. So SQL is something like this:  SELECT department_schema FROM employee LEFT JOIN department where (employee.departmentId = department.id). This part makes sense, the left join is the relationship between department and employee, and more specifically their is a  foreign key relationship directly specified in the sql.Department Model
Department has zero to many Employees, SQL: Select employee_schema FROM department LEFT JOIN department where (department.id = employee.departmentID). I do see that you are using the departmentID is necessary in both queries, but department doesn&#039;t have a specified foreign key. The JOIN condition makes the employee.departmentId, look and act like a foreign key, but this is unknown to the Department Model, if it looking at schema. Is it able to determine the foreign key by referencial integrity rule?</description> <content:encoded><![CDATA[<p>Hi Larry, I first want to say thank you for your tutorials and posts.  I know you hinted at the answer for my following set of questions, but I would like to understand it more technically.<br
/> The question revolves around the Employee&#8217;s and Department&#8217;s model relations method:<br
/> Employee Model<br
/> public function relations()<br
/> {<br
/> return array(&#8216;department&#8217; =&gt; array(self::BELONGS_TO, &#8216;Department&#8217;, &#8216;departmentId&#8217;) );<br
/> }<br
/> Department Model<br
/> public function relations()<br
/> {<br
/> return array(&#8216;employees&#8217; =&gt; array(self::HAS_MANY, &#8216;Employee&#8217;, &#8216;departmentId&#8217;) );<br
/> }<br
/> Why do both models use departmentId as the foreign key(Yii Doc Relational Active Record/declaring relations) when the foreign key exists in only the employee schema?<br
/> I have put a bit of what I believe is going on, and please correct me if I am wrong:</p><p>Employee Model<br
/> Employee belongs to at most one department. So SQL is something like this:  SELECT department_schema FROM employee LEFT JOIN department where (employee.departmentId = department.id). This part makes sense, the left join is the relationship between department and employee, and more specifically their is a  foreign key relationship directly specified in the sql.</p><p>Department Model<br
/> Department has zero to many Employees, SQL: Select employee_schema FROM department LEFT JOIN department where (department.id = employee.departmentID). I do see that you are using the departmentID is necessary in both queries, but department doesn&#8217;t have a specified foreign key. The JOIN condition makes the employee.departmentId, look and act like a foreign key, but this is unknown to the Department Model, if it looking at schema. Is it able to determine the foreign key by referencial integrity rule?</p> ]]></content:encoded> </item> <item><title>By: Larry Irwin</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-27305</link> <dc:creator>Larry Irwin</dc:creator> <pubDate>Wed, 25 Apr 2012 20:50:26 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-27305</guid> <description>This series of posts has made Yii accessible to newbies -- like me...
I have a medical practice management system with 100+ tables.
Every table has a primary key of &quot;id int(10) unsigned NOT NULL auto_increment&quot;.
We never display &quot;id&quot; in the UI. It is used only in the business logic.
Is there a reasonable way to configure Yii to know all the full table structures, but never incorporate &quot;id&quot; into the UI?</description> <content:encoded><![CDATA[<p>This series of posts has made Yii accessible to newbies &#8212; like me&#8230;<br
/> I have a medical practice management system with 100+ tables.<br
/> Every table has a primary key of &#8220;id int(10) unsigned NOT NULL auto_increment&#8221;.<br
/> We never display &#8220;id&#8221; in the UI. It is used only in the business logic.<br
/> Is there a reasonable way to configure Yii to know all the full table structures, but never incorporate &#8220;id&#8221; into the UI?</p> ]]></content:encoded> </item> <item><title>By: Javed</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-23169</link> <dc:creator>Javed</dc:creator> <pubDate>Thu, 23 Feb 2012 11:05:49 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-23169</guid> <description>thanks very much for your kind help</description> <content:encoded><![CDATA[<p>thanks very much for your kind help</p> ]]></content:encoded> </item> <item><title>By: Larry</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-23090</link> <dc:creator>Larry</dc:creator> <pubDate>Wed, 22 Feb 2012 03:41:37 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-23090</guid> <description>Yes.</description> <content:encoded><![CDATA[<p>Yes.</p> ]]></content:encoded> </item> <item><title>By: Javed Boqo</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-22481</link> <dc:creator>Javed Boqo</dc:creator> <pubDate>Thu, 09 Feb 2012 07:04:31 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-22481</guid> <description>Thanks for your kind help but what about views and controller. If I have made changes in view and controller should I change them manually?</description> <content:encoded><![CDATA[<p>Thanks for your kind help but what about views and controller. If I have made changes in view and controller should I change them manually?</p> ]]></content:encoded> </item> <item><title>By: Larry</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-22449</link> <dc:creator>Larry</dc:creator> <pubDate>Wed, 08 Feb 2012 22:22:59 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-22449</guid> <description>If you didn&#039;t modify the Model, you can just regenerate it. If you have already modified the Model, then you can just edit it to recognize the database changes. Or, you can copy the Model you edited, regenerate the Model, and merge the two as appropriate.</description> <content:encoded><![CDATA[<p>If you didn&#8217;t modify the Model, you can just regenerate it. If you have already modified the Model, then you can just edit it to recognize the database changes. Or, you can copy the Model you edited, regenerate the Model, and merge the two as appropriate.</p> ]]></content:encoded> </item> <item><title>By: Javed</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-22388</link> <dc:creator>Javed</dc:creator> <pubDate>Wed, 08 Feb 2012 07:48:59 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-22388</guid> <description>I am new to YII framework. I have just followed the basic concept of creating database and using GII to create model classes. After creating model classes I have changed my database table e.g. inserted new field and now how can get its effect in model classes(views etc)?  When I have regenerate Model then it overwrite my existing work which have already done in model. I need some thing like just refresh my model and it will show all newly made changes from database.</description> <content:encoded><![CDATA[<p>I am new to YII framework. I have just followed the basic concept of creating database and using GII to create model classes. After creating model classes I have changed my database table e.g. inserted new field and now how can get its effect in model classes(views etc)?  When I have regenerate Model then it overwrite my existing work which have already done in model. I need some thing like just refresh my model and it will show all newly made changes from database.</p> ]]></content:encoded> </item> <item><title>By: Larry</title><link>http://www.larryullman.com/2009/11/10/basic-model-edits-in-yii/comment-page-1/#comment-19442</link> <dc:creator>Larry</dc:creator> <pubDate>Fri, 30 Dec 2011 14:23:38 +0000</pubDate> <guid
isPermaLink="false">http://www.larryullman.com/?p=657#comment-19442</guid> <description>Thanks, Abdelaziz, for the nice words and for helping out!</description> <content:encoded><![CDATA[<p>Thanks, Abdelaziz, for the nice words and for helping out!</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Served from: www.larryullman.com @ 2012-05-17 13:22:09 by W3 Total Cache -->
