<?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: Doctrine Gotchas &#8211; delete cascade, SoftDelete and foreignType</title>
	<atom:link href="http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/feed/" rel="self" type="application/rss+xml" />
	<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/</link>
	<description>Life, PHP and Symfony - straight from the monkey's mouth</description>
	<lastBuildDate>Mon, 25 Jul 2011 10:23:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: timbee</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-1395</link>
		<dc:creator>timbee</dc:creator>
		<pubDate>Mon, 21 Feb 2011 18:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-1395</guid>
		<description>By the way, you can also turn on DQL Callbacks in the database.yml file (repost from stackoverflow&#039;s jwconsulting):

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      mysql:host=host;dbname=db
      username: user
      password: password
      attributes:
        use_dql_callbacks: true</description>
		<content:encoded><![CDATA[<p>By the way, you can also turn on DQL Callbacks in the database.yml file (repost from stackoverflow&#8217;s jwconsulting):</p>
<p>all:<br />
  doctrine:<br />
    class: sfDoctrineDatabase<br />
    param:<br />
      dsn:      mysql:host=host;dbname=db<br />
      username: user<br />
      password: password<br />
      attributes:<br />
        use_dql_callbacks: true</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: logicrow</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-1322</link>
		<dc:creator>logicrow</dc:creator>
		<pubDate>Thu, 10 Feb 2011 11:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-1322</guid>
		<description>eat your monkeydust yourself.</description>
		<content:encoded><![CDATA[<p>eat your monkeydust yourself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: muqker</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-431</link>
		<dc:creator>muqker</dc:creator>
		<pubDate>Fri, 27 Aug 2010 13:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-431</guid>
		<description>I think your example of cascade delete is misleading. In the first example, the &quot;SQL foreign key&quot; cascade deletion (onDelete: CASCADE) will trigger the SQL deletion of PhoneNumber when the parent User is deleted. 
However, in the second example, the &quot;doctrine model callback&quot; cascade deletion (cascade: [delete]) will trigger the Doctrine deletion (preDelete(), postDelete(), additional cascading, etc., followed by SQL deletion or soft deletion) of User when any child PhoneNumber is deleted. So the direction of the cascade is now reversed!</description>
		<content:encoded><![CDATA[<p>I think your example of cascade delete is misleading. In the first example, the &#8220;SQL foreign key&#8221; cascade deletion (onDelete: CASCADE) will trigger the SQL deletion of PhoneNumber when the parent User is deleted.<br />
However, in the second example, the &#8220;doctrine model callback&#8221; cascade deletion (cascade: [delete]) will trigger the Doctrine deletion (preDelete(), postDelete(), additional cascading, etc., followed by SQL deletion or soft deletion) of User when any child PhoneNumber is deleted. So the direction of the cascade is now reversed!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benjamin</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-397</link>
		<dc:creator>benjamin</dc:creator>
		<pubDate>Tue, 04 May 2010 14:12:52 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-397</guid>
		<description>second hit in google for &quot;actAs SoftDelete symfony&quot;
and worth reading it (-; - thx</description>
		<content:encoded><![CDATA[<p>second hit in google for &#8220;actAs SoftDelete symfony&#8221;<br />
and worth reading it (-; &#8211; thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-368</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 25 Feb 2010 15:51:35 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-368</guid>
		<description>@dirk Well, for me the &quot;deleted_at&quot; column in the DQL Queries works perfect. Are you shure that you have enabled dql callbacks correctly?</description>
		<content:encoded><![CDATA[<p>@dirk Well, for me the &#8220;deleted_at&#8221; column in the DQL Queries works perfect. Are you shure that you have enabled dql callbacks correctly?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darren</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-364</link>
		<dc:creator>Darren</dc:creator>
		<pubDate>Sat, 06 Feb 2010 00:53:21 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-364</guid>
		<description>Thanks for this information, it helped our company. Was weird because I kept getting integrity constraint violations and wondering why things weren&#039;t cascading.</description>
		<content:encoded><![CDATA[<p>Thanks for this information, it helped our company. Was weird because I kept getting integrity constraint violations and wondering why things weren&#8217;t cascading.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dirk</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-360</link>
		<dc:creator>dirk</dc:creator>
		<pubDate>Fri, 29 Jan 2010 11:27:22 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-360</guid>
		<description>I would be interested in the Symfony and Doctrine versions where SoftDelete really works (I assume it does, otherwise you would not do this report.)
In symfony 1.3.1 with Doctrine 1.2.1 with SoftDelete enabled and dql callbacks set to true doctrine marks deleted table entries correctly (deleted_ad column is filled with actual datetime)
but that does not help much. The problem is: Doctrine queries (DQL) ignore the &quot;deleted_at&quot; field which means that you have to do the filtering manually in an extra where clause.
So I do not see any reason why anyone should use this behaviour because you have to do the filtering on your own.</description>
		<content:encoded><![CDATA[<p>I would be interested in the Symfony and Doctrine versions where SoftDelete really works (I assume it does, otherwise you would not do this report.)<br />
In symfony 1.3.1 with Doctrine 1.2.1 with SoftDelete enabled and dql callbacks set to true doctrine marks deleted table entries correctly (deleted_ad column is filled with actual datetime)<br />
but that does not help much. The problem is: Doctrine queries (DQL) ignore the &#8220;deleted_at&#8221; field which means that you have to do the filtering manually in an extra where clause.<br />
So I do not see any reason why anyone should use this behaviour because you have to do the filtering on your own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephenrs</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-359</link>
		<dc:creator>stephenrs</dc:creator>
		<pubDate>Thu, 28 Jan 2010 15:11:04 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-359</guid>
		<description>Ah, you&#039;re right, sorry I missed that, and thanks for addressing it. Personally, I prefer to define Doctrine/yaml relations at the other end - for me it seems a little more intuitive and easier maintain, by reinforcing the idea that the child table is dependent on the parent, and not the other way around. Your mileage may vary.</description>
		<content:encoded><![CDATA[<p>Ah, you&#8217;re right, sorry I missed that, and thanks for addressing it. Personally, I prefer to define Doctrine/yaml relations at the other end &#8211; for me it seems a little more intuitive and easier maintain, by reinforcing the idea that the child table is dependent on the parent, and not the other way around. Your mileage may vary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-358</link>
		<dc:creator>Russ</dc:creator>
		<pubDate>Thu, 28 Jan 2010 10:49:10 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-358</guid>
		<description>Hmm, I did mention a little while back (if you read upwards) that I would fix that - it&#039;s done now.

Suspicion is good - it makes better developers out of all of us.</description>
		<content:encoded><![CDATA[<p>Hmm, I did mention a little while back (if you read upwards) that I would fix that &#8211; it&#8217;s done now.</p>
<p>Suspicion is good &#8211; it makes better developers out of all of us.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephenrs</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/comment-page-1/#comment-357</link>
		<dc:creator>stephenrs</dc:creator>
		<pubDate>Thu, 28 Jan 2010 02:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204#comment-357</guid>
		<description>Hmmm, I was with you until I got to the &quot;user has many payments&quot; part...putting a payment_id in the user table will never give you the expected result, whether you use Doctrine or not...unless you plan to duplicate the same user record over and over again with different payment_id&#039;s...

The Payment table needs a foreign key to the User table: user_id. Relational DB design 101, no?

This makes the whole post a little suspicious in terms of its usefulness, but thanks anyway.</description>
		<content:encoded><![CDATA[<p>Hmmm, I was with you until I got to the &#8220;user has many payments&#8221; part&#8230;putting a payment_id in the user table will never give you the expected result, whether you use Doctrine or not&#8230;unless you plan to duplicate the same user record over and over again with different payment_id&#8217;s&#8230;</p>
<p>The Payment table needs a foreign key to the User table: user_id. Relational DB design 101, no?</p>
<p>This makes the whole post a little suspicious in terms of its usefulness, but thanks anyway.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

