<?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: TRUNCATE TABLE with Symfony and Doctrine</title>
	<atom:link href="http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/</link>
	<description>A day in the life of...</description>
	<lastBuildDate>Tue, 10 Jan 2012 15:00:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: Christopher Shennan</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-5087</link>
		<dc:creator>Christopher Shennan</dc:creator>
		<pubDate>Thu, 15 Dec 2011 18:27:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-5087</guid>
		<description>Hi Christian,

That would delete all the records and should take care of removing the related tables too provided the relationship is CASCADE DELETE and not CASCADE SET NULL.  If the relationship is CASCADE SET NULL then you are leaving redundant data behind which may be perfectly valid in normal operation but probably not while repeatedly running the import scripts.

Unfortunately that way wouldn&#039;t result in the index being reset which may not always matter, but if as per my first point you have id specific import logic then subsequent attempts would likely not work as anticipated.

Many thanks.

Chris.</description>
		<content:encoded><![CDATA[<p>Hi Christian,</p>
<p>That would delete all the records and should take care of removing the related tables too provided the relationship is CASCADE DELETE and not CASCADE SET NULL.  If the relationship is CASCADE SET NULL then you are leaving redundant data behind which may be perfectly valid in normal operation but probably not while repeatedly running the import scripts.</p>
<p>Unfortunately that way wouldn&#8217;t result in the index being reset which may not always matter, but if as per my first point you have id specific import logic then subsequent attempts would likely not work as anticipated.</p>
<p>Many thanks.</p>
<p>Chris.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-5058</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 18 Nov 2011 18:20:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-5058</guid>
		<description>Doctrine::getTable(&#039;OrderItems&#039;)-&gt;findAll()-&gt;delete() ?</description>
		<content:encoded><![CDATA[<p>Doctrine::getTable(&#8216;OrderItems&#8217;)-&gt;findAll()-&gt;delete() ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Shennan</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-3947</link>
		<dc:creator>Christopher Shennan</dc:creator>
		<pubDate>Thu, 25 Nov 2010 19:07:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-3947</guid>
		<description>Hi Ariaan

The problem with ./symfony doctrine:build –all –and-load; ./symfony cc is that it is completely nukes the database and loads everything from scratch so you have to have fixtures defined for all your data.  In my case I was working on importing data for a few tables and someone else was working on other parts of the system so this was not appropriate.

Using truncate in the way I have mentioned meant I could get my data import tasks to only clean out the tables which I needed to work with whilst leaving the rest of the system intact, usable by the other person and avoiding possible loss of data due to records not being in the fixtures.yml (added or edited via the administration pages but not converted back in to the fixtures.yml)

In addition, the trouble with doing all the data in fixtures.yml is that it is not particularly client friendly.  For a developer, it is probably no harder to maintain the fixtures.yml or a equivalent CSV file but I find that the client typically prefers something they can easily visualise, hence why I was importing using a CSV file (which the client was constantly updating and I was re-importing) rather than using a fixtures.yml.  That said, there is nothing wrong with using a fixtures.yml to do the same job.

I hope this clears up why I was using truncate and a CSV in this manner.

Many Thanks.

Chris</description>
		<content:encoded><![CDATA[<p>Hi Ariaan</p>
<p>The problem with ./symfony doctrine:build –all –and-load; ./symfony cc is that it is completely nukes the database and loads everything from scratch so you have to have fixtures defined for all your data.  In my case I was working on importing data for a few tables and someone else was working on other parts of the system so this was not appropriate.</p>
<p>Using truncate in the way I have mentioned meant I could get my data import tasks to only clean out the tables which I needed to work with whilst leaving the rest of the system intact, usable by the other person and avoiding possible loss of data due to records not being in the fixtures.yml (added or edited via the administration pages but not converted back in to the fixtures.yml)</p>
<p>In addition, the trouble with doing all the data in fixtures.yml is that it is not particularly client friendly.  For a developer, it is probably no harder to maintain the fixtures.yml or a equivalent CSV file but I find that the client typically prefers something they can easily visualise, hence why I was importing using a CSV file (which the client was constantly updating and I was re-importing) rather than using a fixtures.yml.  That said, there is nothing wrong with using a fixtures.yml to do the same job.</p>
<p>I hope this clears up why I was using truncate and a CSV in this manner.</p>
<p>Many Thanks.</p>
<p>Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ariaan Bruinsma</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-3945</link>
		<dc:creator>Ariaan Bruinsma</dc:creator>
		<pubDate>Thu, 25 Nov 2010 15:13:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-3945</guid>
		<description>Isn&#039;t this sufficiant?

./symfony doctrine:build --all --and-load; ./symfony cc

This way you only have to maintain the schema.yml and fixtures.yml.

Or didn&#039;t I understand the main point?</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t this sufficiant?</p>
<p>./symfony doctrine:build &#8211;all &#8211;and-load; ./symfony cc</p>
<p>This way you only have to maintain the schema.yml and fixtures.yml.</p>
<p>Or didn&#8217;t I understand the main point?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Shennan</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-2957</link>
		<dc:creator>Christopher Shennan</dc:creator>
		<pubDate>Thu, 09 Sep 2010 19:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-2957</guid>
		<description>Hi jbreuer,

Thank you for the clarification.  I&#039;ve updated $doctrine to $dbh to help avoid confusion with this example.

Many Thanks.

Chris Shennan</description>
		<content:encoded><![CDATA[<p>Hi jbreuer,</p>
<p>Thank you for the clarification.  I&#8217;ve updated $doctrine to $dbh to help avoid confusion with this example.</p>
<p>Many Thanks.</p>
<p>Chris Shennan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jbreuer</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-2952</link>
		<dc:creator>jbreuer</dc:creator>
		<pubDate>Thu, 09 Sep 2010 07:18:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-2952</guid>
		<description>What you get with:

$doctrine = Doctrine_Manager::getInstance()-&gt;getCurrentConnection()-&gt;getDbh();

is a PDO-Object (in most cases), so the naming of the variable ($doctrine) could lead to confussion.</description>
		<content:encoded><![CDATA[<p>What you get with:</p>
<p>$doctrine = Doctrine_Manager::getInstance()-&gt;getCurrentConnection()-&gt;getDbh();</p>
<p>is a PDO-Object (in most cases), so the naming of the variable ($doctrine) could lead to confussion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Shennan</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-1647</link>
		<dc:creator>Christopher Shennan</dc:creator>
		<pubDate>Fri, 12 Feb 2010 22:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-1647</guid>
		<description>I don&#039;t see why not although I think DROP and ALTER table statements should really be handled with &lt;a href=&quot;http://www.symfony-project.org/doctrine/1_2/en/07-Migrations&quot; rel=&quot;nofollow&quot;&gt;migrations&lt;/a&gt;.

I&#039;ve started using these recently and although I&#039;ve found there are a few things you need to remember when using them they work really well and really reduces the problems when applying database changes from development to test to live servers.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t see why not although I think DROP and ALTER table statements should really be handled with <a href="http://www.symfony-project.org/doctrine/1_2/en/07-Migrations">migrations</a>.</p>
<p>I&#8217;ve started using these recently and although I&#8217;ve found there are a few things you need to remember when using them they work really well and really reduces the problems when applying database changes from development to test to live servers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Parag</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-1643</link>
		<dc:creator>Parag</dc:creator>
		<pubDate>Fri, 12 Feb 2010 09:27:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-1643</guid>
		<description>Thanks a lot! I don&#039;t know where this is in the Doctrine docs, but your solution is exactly what i was looking for. Can we use DROP and ALTER table statements in the same way?</description>
		<content:encoded><![CDATA[<p>Thanks a lot! I don&#8217;t know where this is in the Doctrine docs, but your solution is exactly what i was looking for. Can we use DROP and ALTER table statements in the same way?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivar</title>
		<link>http://www.chrisshennan.com/2009/11/20/truncate-table-with-symfony-and-doctrine/comment-page-1/#comment-1623</link>
		<dc:creator>Ivar</dc:creator>
		<pubDate>Sun, 07 Feb 2010 16:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisshennan.com/?p=178#comment-1623</guid>
		<description>Thank you. 

Trunkating all tables in phpMyAdmin was driving me crazy.  I saved myself some typing by separating the query with ;

TRUNCATE TABLE Article; TRUNCATE TABLE User; ...</description>
		<content:encoded><![CDATA[<p>Thank you. </p>
<p>Trunkating all tables in phpMyAdmin was driving me crazy.  I saved myself some typing by separating the query with ;</p>
<p>TRUNCATE TABLE Article; TRUNCATE TABLE User; &#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

