<?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/"
		>
<channel>
	<title>Comments on: Inheritance with symfony and Doctrine ORM</title>
	<atom:link href="http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/</link>
	<description>A Blog About Software Development, Databases, And Stuff That Doesn&#039;t Have To Do With Computers</description>
	<lastBuildDate>Tue, 22 Jun 2010 12:48:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-398</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 15 Jun 2010 19:21:42 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-398</guid>
		<description>What I&#039;d like to find is a method of having the objects so that the common values are in the parent table and only the sub-class specific columns are in a separate table (that is handled auto-magically, as that is what I am doing by hand currently).

cow (purpose) -&gt; farm_animal (name, sound, leg_count)
milk_cow (quantity) -&gt; cow (purpose) -&gt; farm_animal</description>
		<content:encoded><![CDATA[<p>What I&#8217;d like to find is a method of having the objects so that the common values are in the parent table and only the sub-class specific columns are in a separate table (that is handled auto-magically, as that is what I am doing by hand currently).</p>
<p>cow (purpose) -&gt; farm_animal (name, sound, leg_count)<br />
milk_cow (quantity) -&gt; cow (purpose) -&gt; farm_animal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prasad</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-349</link>
		<dc:creator>Prasad</dc:creator>
		<pubDate>Thu, 10 Jun 2010 08:28:06 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-349</guid>
		<description>Agree with Kev.
Concrete Inheritance is used primarily for different entities of the same parent class

example 1: types of &#039;people&#039;: user, agent, admin, supplier contact, customer contact, employee

example 2: options (name, value): gender, phone-type, account types, dept codes</description>
		<content:encoded><![CDATA[<p>Agree with Kev.<br />
Concrete Inheritance is used primarily for different entities of the same parent class</p>
<p>example 1: types of &#8216;people&#8217;: user, agent, admin, supplier contact, customer contact, employee</p>
<p>example 2: options (name, value): gender, phone-type, account types, dept codes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kev</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-263</link>
		<dc:creator>Kev</dc:creator>
		<pubDate>Mon, 31 May 2010 18:31:06 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-263</guid>
		<description>The key advantage I found with using the column aggregation is that you can use dql to query the parent table and then get back the child objects. This will hopefully come in real handy on a project I&#039;m working on where there&#039;s a public timeline of actions and when I query get the last 20 actions I only need to query one table and every entry in the timeline can have it&#039;s own individual ID</description>
		<content:encoded><![CDATA[<p>The key advantage I found with using the column aggregation is that you can use dql to query the parent table and then get back the child objects. This will hopefully come in real handy on a project I&#8217;m working on where there&#8217;s a public timeline of actions and when I query get the last 20 actions I only need to query one table and every entry in the timeline can have it&#8217;s own individual ID</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphael</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-236</link>
		<dc:creator>Raphael</dc:creator>
		<pubDate>Fri, 28 May 2010 21:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-236</guid>
		<description>Good post!

I agree with the conclusion that concrete inheritance mode is the best one among the three. But the mileage may vary depending on the specific need and circumstances.

I wish to add the issue with concrete inheritance which nini has just raised. Even the concrete inheritance mode is not complete enough for the needs of true object-oriented logic: although there exists a top-level table farm_animal, this table will always be empty. The dogs, cows and chicken are exclusively stored in their respective tables, and none of them at all in the base class table. This arrangement is unlucky, as it inhibits browsing and quering through _all_ FarmAnimals, no matter which their (sub-)class is.
So e.g. it is not possible to search for an animal called &quot;Rosa&quot;, without knowing whether Rosa is a dog or a cow.
And more importantly, as nini is stating, you can&#039;t setup an association between FarmAnimal and e.g. Farm (&quot;a farm has zero, one or more animals&quot;).

Doctrine 2.0 may sometimes offer true full inheritance functionality by introducing &quot;table inheritance&quot;. That mode should avoid any redundancy (no same field exists in multiple tables) and then have the base class&#039; table store its part of each object, now allowing queries to be made on FarmAnimal level.</description>
		<content:encoded><![CDATA[<p>Good post!</p>
<p>I agree with the conclusion that concrete inheritance mode is the best one among the three. But the mileage may vary depending on the specific need and circumstances.</p>
<p>I wish to add the issue with concrete inheritance which nini has just raised. Even the concrete inheritance mode is not complete enough for the needs of true object-oriented logic: although there exists a top-level table farm_animal, this table will always be empty. The dogs, cows and chicken are exclusively stored in their respective tables, and none of them at all in the base class table. This arrangement is unlucky, as it inhibits browsing and quering through _all_ FarmAnimals, no matter which their (sub-)class is.<br />
So e.g. it is not possible to search for an animal called &#8220;Rosa&#8221;, without knowing whether Rosa is a dog or a cow.<br />
And more importantly, as nini is stating, you can&#8217;t setup an association between FarmAnimal and e.g. Farm (&#8220;a farm has zero, one or more animals&#8221;).</p>
<p>Doctrine 2.0 may sometimes offer true full inheritance functionality by introducing &#8220;table inheritance&#8221;. That mode should avoid any redundancy (no same field exists in multiple tables) and then have the base class&#8217; table store its part of each object, now allowing queries to be made on FarmAnimal level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jason</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-184</link>
		<dc:creator>jason</dc:creator>
		<pubDate>Tue, 18 May 2010 13:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-184</guid>
		<description>Nini, if there&#039;s a one-to-one relationship between User and Admin, what&#039;s wrong with having Document&#039;s foreign key point to User?</description>
		<content:encoded><![CDATA[<p>Nini, if there&#8217;s a one-to-one relationship between User and Admin, what&#8217;s wrong with having Document&#8217;s foreign key point to User?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nini</title>
		<link>http://jasonswett.net/inheritance-with-symfony-and-doctrine-orm/comment-page-1/#comment-182</link>
		<dc:creator>nini</dc:creator>
		<pubDate>Tue, 18 May 2010 09:32:44 +0000</pubDate>
		<guid isPermaLink="false">http://jasonswett.net/blog/?p=263#comment-182</guid>
		<description>Concrete inheritance doesn&#039;t work well with relations between models because of strict foreign keys checks (Mysql/Innodb). So if you have such schema:

---
detect_relations: true
User:
 columns:
  username: string

Admin:
 inheritance:
  extends: User
  type: concrete

Moderator:
 inheritance:
   extends: User
   type: concrete

Document
 columns:
  description: string
  user_id: integer 

then it will be not possible to save a Document, say, for an Administrator, because mysql will try to check if such user exists in User(!) table, not in administrator table. So it why i&#039;m forced to use column aggregation inheritance.</description>
		<content:encoded><![CDATA[<p>Concrete inheritance doesn&#8217;t work well with relations between models because of strict foreign keys checks (Mysql/Innodb). So if you have such schema:</p>
<p>&#8212;<br />
detect_relations: true<br />
User:<br />
 columns:<br />
  username: string</p>
<p>Admin:<br />
 inheritance:<br />
  extends: User<br />
  type: concrete</p>
<p>Moderator:<br />
 inheritance:<br />
   extends: User<br />
   type: concrete</p>
<p>Document<br />
 columns:<br />
  description: string<br />
  user_id: integer </p>
<p>then it will be not possible to save a Document, say, for an Administrator, because mysql will try to check if such user exists in User(!) table, not in administrator table. So it why i&#8217;m forced to use column aggregation inheritance.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
