<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Connecting the dots... &#187; doctrine</title>
	<atom:link href="http://blog.rajatpandit.com/tag/doctrine/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rajatpandit.com</link>
	<description>Thoughts on Web Development, Scalability and Application Architecture</description>
	<lastBuildDate>Mon, 19 Jul 2010 12:46:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Ordering List of Items &#8211; Doctrine / Symfony 1.4</title>
		<link>http://blog.rajatpandit.com/2010/03/27/ordering-list-of-items-doctrine-symfony-1-4/</link>
		<comments>http://blog.rajatpandit.com/2010/03/27/ordering-list-of-items-doctrine-symfony-1-4/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 09:10:44 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=464</guid>
		<description><![CDATA[Recently I had a requirement to write an interface that allows users to change order of elements and move them up and down. I would an interesting cookbook entry on symfony&#8216;s website but it used propel as an ORM. Since my project uses doctrine, I had to implement the same in doctrine. Documenting this here [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a requirement to write an interface that allows users to change order of elements and move them up and down. I would an interesting <a href="http://www.symfony-project.org/cookbook/1_0/en/sortable">cookbook entry on </a><a href="http://symfony-project.org">symfony</a>&#8216;s website but it used <a href="http://propel.phpdb.org/">propel</a> as an ORM. Since my project uses doctrine, I had to implement the same in doctrine. Documenting this here so that someone else might find it useful.</p>
<p>So this is what we want to achieve.</p>
<div id="attachment_466" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.rajatpandit.com/wp-content/uploads/2010/03/sort-screenshot.png"><img class="size-medium wp-image-466" title="sort-screenshot" src="http://blog.rajatpandit.com/wp-content/uploads/2010/03/sort-screenshot-300x188.png" alt="" width="300" height="188" /></a><p class="wp-caption-text">Example of Changing order for elements</p></div>
<p>So first things first, let me define the schema that I am was using:</p>
<pre class="brush: bash;">
ReportXReportModule:
  columns:
    id:                                 { type: integer(4), notnull: true, primary: true, autoincrement: true}
    report_id:                      { type: integer(4), notnull: true}
    report_module_id:         { type: integer(4), notnull: true}
    module_order:               { type: integer(2), notnull: true}
</pre>
<p>The <code>module_order</code> is the field to be used to store the order of the module. So here&#8217;s adding a bunch of methods in the model class. So the requirement for this task is that the entry is also to be identified by the report. So in case you need to use these methods, you would have to adapt it to your requirement.<br />
New methods in <code>ReportXReportModuleTable.class.php</code><br />
Fetch a report by Report ID and Order </p>
<pre class="brush: php;">
  public static function getByReportAndOrder($report_id, $module_order)
  {
    $data = Doctrine_Query::create()
          -&gt;from('ReportXReportModule rrm')
          -&gt;where('rrm.report_id = ?', $report_id)
          -&gt;andWhere('rrm.module_order = ?', $module_order)
          -&gt;fetchOne();
    if (!$data) {
      return false;
    }
    // send this back if this a sensible record
    return $data;
  }
</pre>
<p>For the given report find the highest value of order</p>
<pre class="brush: php;">
  public static function getMaxOrderByReport($report_id)
  {
    $order = 0;
    if (!is_numeric($report_id)) {
      return $order;
    }
    $record = Doctrine_Query::create()
                -&gt;select('MAX(rrm.module_order)')
                -&gt;from('ReportXReportModule rrm')
                -&gt;where('rrm.report_id = ?', $report_id)
                -&gt;fetchArray();

    if (count($record) != 1) {
      return $order;
    } else {
      if (isset($record[0]['MAX'])) {
        $order = $record[0]['MAX'];
      }
    }

    return $order;
  }
</pre>
<p>New methods in <code>ReportXReportModuleTable.class.php.<br />
</code></p>
<p>Get all the records for a given report ID and return them sorted by their order (ranking)</p>
<pre class="brush: php;">
  public static function getModulesByReport($report_id)
  {
    $records = array();
    if (!is_numeric($report_id)) {
      return $records;
    }
    $records = Doctrine_Query::create()
                -&gt;from('ReportXReportModule rrm')
                -&gt;where('rrm.report_id = ?', $report_id)
                -&gt;leftJoin('rrm.ReportModule rm')
                -&gt;orderBy('rrm.module_order asc')
                -&gt;fetchArray();
    return $records;
  }
</pre>
<p>This is an interesting method, this is used to swap a record with another record. You shall see how this method is useful for the up and down actions that will follow shortly. This is also done within a transaction to ensure that the integrity of the order for modules is retained.</p>
<pre class="brush: php;">
  public function swapWith($module)
  {
    $conn = Doctrine_Manager::connection();
    try {
      $conn-&gt;beginTransaction();
        $order = $this-&gt;getModuleOrder();
        $this-&gt;setModuleOrder($module-&gt;getModuleOrder());
        $this-&gt;save();
        $module-&gt;setModuleOrder($order);
        $module-&gt;save();
      $conn-&gt;commit();
    } catch (Doctrin_Exception $e) {
      $conn-&gt;rollback();
    }
  }
</pre>
<p>This method is useful to delete a module. This not only just deletes the entry but also updates the order of the reset of the modules with a order higher than the current module.</p>
<pre class="brush: php;">
  public function deleteByReport($report_id)
  {
    $conn = Doctrine_Manager::connection();
    try {
      $conn-&gt;beginTransaction();
      // decrease all the orders by 1 for all elements that have a rank greater than this rank
      // execute custom sql to do that
      $q = Doctrine_Query::create()
            -&gt;update('ReportXReportModule rrm')
            -&gt;set('rrm.module_order','rrm.module_order - 1' )
            -&gt;where('rrm.module_order &gt; ?', $this-&gt;module_order)
            -&gt;execute();

      $this-&gt;delete();
      $conn-&gt;commit();

    } catch(Doctrin_Exception $e) {
      $conn-&gt;rollback();
    }
  }
</pre>
<p>Now that we have all the required  methods in our model classes, its time to write the first action that will display all the modules. So the code snippet from the action is:</p>
<pre class="brush: php;">
  public function executeIndex(sfWebRequest $request)
  {
    // get the list of all the modules
    $this-&gt;report_modules = ReportXReportModuleTable::getModulesByReport($this-&gt;current_report-&gt;getId());
    $this-&gt;max_order      = ReportXReportModuleTable::getMaxOrderByReport($this-&gt;current_report-&gt;getId());
    }
</pre>
<p>and the corresponding template for that is:</p>
<pre class="brush: php;">
&lt;h2&gt;List Of Current Modules&lt;/h2&gt;
&lt;?php if (count($report_modules)&gt; 0) : ?&gt;
  &lt;ol class=&quot;report-modules&quot;&gt;
  &lt;?php foreach($report_modules as $module): ?&gt;
    &lt;li&gt;
      &lt;div class=&quot;name&quot;&gt;
        &lt;?= $module['ReportModule']['name']?&gt;
      &lt;/div&gt;
      &lt;div class=&quot;order&quot;&gt;
        &lt;?php if ($module['module_order'] &gt; 0) : ?&gt;
          &lt;?= link_to('Up', 'reportmodulemanager/up?id=' . $module['id'])?&gt;
        &lt;?php endif;?&gt;

        &lt;?php if ($module['module_order'] != $max_order) : ?&gt;
          &lt;?= link_to('Down', 'reportmodulemanager/down?id=' . $module['id'])?&gt;
        &lt;?php endif;?&gt;
      &lt;/div&gt;
      &lt;div class=&quot;action&quot;&gt;
        &lt;?php if (1 == $module['ReportModule']['require_local_configuration']) : ?&gt;
          &lt;?= link_to('Configure', 'reportmodulemanager/configure?id=' . $module['id'])?&gt;
        &lt;?php endif;?&gt;
        &lt;?= link_to('Remove', 'reportmodulemanager/delete?id=' . $module['id'])?&gt;
      &lt;/div&gt;

    &lt;/li&gt;
  &lt;?php endforeach;?&gt;
  &lt;/ol&gt;
&lt;?php endif?&gt;
</pre>
<p>As you can see each module has an <code>up</code> option only when its <code>order</code> is greater than 0. Similarly the module has a <code>down</code> option only when its order is not the same as the highest value for <code>order</code></p>
<p>Now tying in the up and down actions. </p>
<pre class="brush: php;">
  public function executeUp(sfWebRequest $request)
  {
    $reportmodule = Doctrine::getTable('ReportXReportModule');
    $item = $reportmodule-&gt;find($request-&gt;getParameter('id'));
    $this-&gt;forward404Unless($item);

    $previous_item = ReportXReportModuleTable::getByReportAndOrder(
        $this-&gt;current_report-&gt;getId(),
        ($item-&gt;getModuleOrder() - 1)
      );
    $this-&gt;forward404Unless($previous_item);

    $item-&gt;swapWith($previous_item);
    $this-&gt;redirect('reportmodulemanager/index');
  }
</pre>
<p>and the for the <code>down</code> action:</p>
<pre class="brush: php;">
public function executeDown(sfWebRequest $request)
  {
    $reportmodule = Doctrine::getTable('ReportXReportModule');
    $item = $reportmodule-&gt;find($request-&gt;getParameter('id'));
    $this-&gt;forward404Unless($item);

    $next_item = ReportXReportModuleTable::getByReportAndOrder(
        $this-&gt;current_report-&gt;getId(),
        ($item-&gt;getModuleOrder() + 1)
      );
    $this-&gt;forward404Unless($next_item);

    $item-&gt;swapWith($next_item);
    $this-&gt;redirect('reportmodulemanager/index');
  }
 </pre>
<p>As you can see we swap a module with one after it for the Up action, similarly we swap a module with one after it for the down action.</p>
<p>And that&#8217;s pretty much it to have a list that can be sorted. The other interesting actions would be when you add a new record or remove on. At this point you  must have figured out that adding a new record should be pretty straight forward as you have now methods to access the <code>highest rank</code> using the method <code>ReportXReportModuleTable::getMaxOrderByReport</code></p>
<p>As a part of this post, one day I shall add how to progressively enhance so give it a fancy drag and drop interface as suggested in the original article. However if you have any questions or suggestions to make this better, please feel free to leave a note below.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2010/03/27/ordering-list-of-items-doctrine-symfony-1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doctrine: Multiple One-To-One Relation to same table</title>
		<link>http://blog.rajatpandit.com/2009/12/26/doctrine-multiple-one-to-one-relation-to-same-table/</link>
		<comments>http://blog.rajatpandit.com/2009/12/26/doctrine-multiple-one-to-one-relation-to-same-table/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 23:21:08 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA["multiple one to one relationships"]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[Foreign Key]]></category>
		<category><![CDATA[Normalization]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=430</guid>
		<description><![CDATA[I am currently using sfGuardUser table from the sfDoctrineGuardPlugin to link up to a messages table which stores the user id of sender and receiver. To ensure that the data schema is properly normalised I need to make sure that both the user id are actually foreign keys to the sfGuardUser table. Here are the [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently using <code>sfGuardUser</code> table from the <code>sfDoctrineGuardPlugin</code> to link up to a <code>messages</code> table which stores the user id of sender and receiver. To ensure that the data schema is properly normalised I need to make sure that both the user id are actually foreign keys to the <code>sfGuardUser</code> table. Here are the schemas to get a better under standing of what I am talking about:</p>
<pre class="brush: bash;">
sfGuardUser:
  actAs: [Timestampable]
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    username:
      type: string(128)
      notnull: true
      unique: true
    algorithm:
      type: string(128)
      default: sha1
      notnull: true
    salt: string(128)
    password: string(128)
    is_active:
      type: boolean
      default: 1
    is_super_admin:
      type: boolean
      default: false
    last_login:
      type: timestamp
  indexes:
    is_active_idx:
      fields: [is_active]
  relations:
    groups:
      class: sfGuardGroup
      local: user_id
      foreign: group_id
      refClass: sfGuardUserGroup
      foreignAlias: Users
    permissions:
      class: sfGuardPermission
      local: user_id
      foreign: permission_id
      refClass: sfGuardUserPermission
      foreignAlias: Users

Message:
  actAs:
    Timestampable: ~
  columns:
    user_from_id:                  { type: integer(4), notnull: true }
    user_to_id:                    { type: integer(4), notnull: true }
    date_sent:                     { type: timestamp }
    date_read:                     { type: timestamp }
    alertSent:                     { type: boolean, default: false, notnull: true }
    subject:                       { type: string(255), notnull: true }
    body:                          { type: string(255), notnull: true }
  relations:
    Sent:
      class: sfGuardUser
      local: user_from_id
      foreign: id
      type: one
    Recv:
      class: sfGuardUser
      local: user_to_id
      foreign: id
      type: one
</pre>
<p>A couple of things to remember on how I got it working</p>
<ul>
<li>The name of the relationship has to be unique, if the same one is used the last one will be used</li>
<li>You need to use <code>class</code> property to tell it the name of the Model class to use</li>
<li>Have to 100% ensure that the datatype and <strong>size</strong> are the same otherwise the <code>ALTER...</code> sqls generated won&#8217;t work. I had issues of using <code>integer(4)</code> and <code>integer</code> and it took me 10mins of scratching my head to wonder what was wrong</li>
</ul>
<p>Hope this helps someone with a similar problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2009/12/26/doctrine-multiple-one-to-one-relation-to-same-table/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating utf-8 tables in symfony 1.4 /doctrine 1.2</title>
		<link>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/</link>
		<comments>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 00:35:32 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=421</guid>
		<description><![CDATA[Recently I had an issue on one of my work websites where the database schema was setup in Latin-1 encoding, this was fine till the encoding of the website was also set to iso-8859-1 and nothing fancy was going on. However later in the last few months, I had been doing some development which required [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had an issue on one of my work websites where the database schema was setup in Latin-1 encoding, this was fine till the encoding of the website was also set to iso-8859-1 and nothing fancy was going on. However later in the last few months, I had been doing some development which required me to change the encoding to utf-8 and that resulted in a lot of issues. Some I am still resolving. One of the two solutions that we came up was assign it a custom function for &#8216;escaping_strategy&#8217;, which however wasn&#8217;t the silver bullet to fix as there was more crazy code that was getting raw value from the model and hence our function would get by passed. I am still looking for better ways of fixing it (seems very likely a case of massive re-factoring required) however, this one tip was handy.</p>
<p>If you want to create an individual table to be utf-8 then in the schema.yml you can add.</p>
<pre class="brush: bash;">
User:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8
  columns:
    username: string(255)
    password: string(255)
</pre>
<p>However this can be a painful repetitive task, especially if you have loads and loads of tables to work with. In case you are like me and prefer all your tables to be utf-8 by default, you can add this function to your ProjectConfiguration.class.php file.</p>
<pre class="brush: php;">
  public function configureDoctrine(Doctrine_Manager $manager)
  {
    $manager-&gt;setCollate('utf8_unicode_ci');
    $manager-&gt;setCharset('utf8');
  }
</pre>
<p>and then rebuild all the models (and possibly load your fixtures if you have any.</p>
<pre class="brush: bash;">
# symfony doctrine:build --all --and-load --env=dev --no-confirmation
</pre>
<p>Obviously bare in mind that this will drop your database and re-create the tables with utf-8 encoding. </p>
<p>If anyone has any suggestions for my problem, do leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2009/12/19/creating-utf-8-tables-in-symfony-1-4-doctrine-1-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[Doctrine_Parser_Exception] Fail-some error message!</title>
		<link>http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/</link>
		<comments>http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 17:50:26 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[jwage]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=369</guid>
		<description><![CDATA[If your precious evening hacking time has been wasted by this useless error message: rp@devbox:trunk$ php symfony --trace doctrine:build-all-reload --no-confirmation &#62;&#62; doctrine dropping databases &#62;&#62; doctrine Successfully dropped database f...octrine&#34; named &#34;secret_project&#34; &#62;&#62; doctrine creating databases &#62;&#62; doctrine Successfully created database f...octrine&#34; named &#34;secret_project&#34; &#62;&#62; doctrine generating model classes [Doctrine_Parser_Exception] Unable to parse string: Unable [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.doctrine-project.org/"><img src="http://blog.rajatpandit.com/wp-content/uploads/2009/08/doctrine-orm-php5.png" alt="doctrine" title="doctrine" width="191" height="53" class="alignright size-full wp-image-370" /></a><br />
If your precious evening hacking time has been wasted by this useless error message:</p>
<pre class="brush: bash;">
rp@devbox:trunk$ php symfony --trace doctrine:build-all-reload --no-confirmation
&gt;&gt; doctrine  dropping databases
&gt;&gt; doctrine  Successfully dropped database f...octrine&quot; named &quot;secret_project&quot;
&gt;&gt; doctrine  creating databases
&gt;&gt; doctrine  Successfully created database f...octrine&quot; named &quot;secret_project&quot;
&gt;&gt; doctrine  generating model classes

  [Doctrine_Parser_Exception]
  Unable to parse string: Unable to parse line 0 (  

Exception trace:
  at ...
....
</pre>
<p>Then look no further, this was the oddest error message which caused errors inconsistently when generating models or updating the schema files. It turned out that the error was due to </p>
<ul>
<li>vim swap files</li>
<li>osx ._ files</li>
</ul>
<p>The parser would pick up all the files even if it started with a . (dot) which then borks of-course coz it wasn&#8217;t in the format it would expect it to be in</p>
<p>What would have been useful would be to have more meaningful error message like full path+file name and also the parser shouldnt pickup . (dot) files in the first place, dont see why a developer would want to keep his config files starting with a . (dot) unless its a .htaccess file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony development process</title>
		<link>http://blog.rajatpandit.com/2009/07/11/symfony-development-process/</link>
		<comments>http://blog.rajatpandit.com/2009/07/11/symfony-development-process/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 10:48:55 +0000</pubDate>
		<dc:creator>rp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[build process]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://blog.rajatpandit.com/?p=345</guid>
		<description><![CDATA[My development process involves using doctrine and svn. Documenting my development steps to make sure I can put this is some sort of build script in future. Creating svn directories svn mkdir -m &#34;create default directories&#34; http://svn.clients.rajatpandit.com/project-name/trunk http://svn.clients.rajatpandit.com/project-name/tags http://svn.clients.rajatpandit.com/project-name/branches Checkout these directories locally: svn co http://svn.clients.rajatpandit.com/project-name/ . Move to the trunk directory cd trunk Creating [...]]]></description>
			<content:encoded><![CDATA[<p>My development process involves using <a href="http://www.doctrine-project.org/">doctrine</a> and <a href="http://subversion.tigris.org/">svn</a>. Documenting my development steps to make sure I can put this is some sort of build script in future.</p>
<p>Creating svn directories</p>
<pre class="brush: bash;">
svn mkdir -m &quot;create default directories&quot; http://svn.clients.rajatpandit.com/project-name/trunk http://svn.clients.rajatpandit.com/project-name/tags http://svn.clients.rajatpandit.com/project-name/branches
</pre>
<p>Checkout these directories locally:</p>
<pre class="brush: bash;">
svn co http://svn.clients.rajatpandit.com/project-name/ .
</pre>
<p>Move to the <code>trunk</code> directory</p>
<pre class="brush: bash;">
cd trunk
</pre>
<p>Creating a new project</p>
<pre class="brush: bash;">
$  symfony generate:project brp
$ php symfony generate:app --escaping-strategy=on --csrf-secret=s3cr3t fe
</pre>
<p>Clear cache and log and add that to svn</p>
<pre class="brush: bash;">
rm -rf cache/* log/*
chmod 777 cache/ log/
svn add *
</pre>
<pre class="brush: bash;">
svn propedit svn:ignore cache
svn propedit svn:ignore log
</pre>
<p>Enter * in both the cases so that no files in cache and log get commited to svn</p>
<p>Add the new files to svn</p>
<pre class="brush: bash;">
svn ci -m 'adding the initial set of files'
</pre>
<p>Update the database settings, add the doctrine plugin and disable the propel plugin instead, edit the file <code>config/ProjectConfiguration.class.php</code><br />
and update the line with the following line:</p>
<pre class="brush: php;">
  $this-&gt;enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));
</pre>
<p>Publish the plug-in assets</p>
<pre class="brush: bash;">
rp@devbox:~/websites/project-name/trunk$ php symfony plugin:publish-assets
    plugin    Configuring plugin - sfProtoculousPlugin
    plugin    Configuring plugin - sfDoctrinePlugin
</pre>
<p>Delete the files for the propel plugin:</p>
<pre class="brush: bash;">
svn delete web/sfPropelPlugin
svn delete config/propel.ini
svn delete config/schema.yml
svn mkdir config/doctrine
</pre>
<p>Create new schema file and remove the default schema file.</p>
<pre class="brush: bash;">
rp@devbox:~/websites/project-name/trunk$ cd config/doctrine/
rp@devbox:~/websites/project-name/trunk/config/doctrine$ touch schema.yml
rp@devbox:~/websites/project-name/trunk/config/doctrine$ svn add schema.yml
A         schema.yml
rp@devbox:~/websites/project-name/trunk/config/doctrine$ svn ci -m 'adding schema for app'

svn delete config/databases.yml
svn ci -m 'removed the default databases.yml file'
</pre>
<p>Add database configuration settings:</p>
<pre class="brush: bash;">
php symfony configure:database --name=doctrine --class=sfDoctrineDatabase &quot;mysql:host=127.0.0.1;dbname=project1&quot; root password
</pre>
<p>Link to externals so that the  latest version of the plugins and symfony gets checked out:</p>
<pre class="brush: bash;">
cd lib/
svn mkdir vendor
svn propedit svn:externals lib/vendor
svn ci -m 'updating symfony to version 1.2.7'
svn update lib/vendor/
</pre>
<p>That pulls out the most updated tagged version  of <a href="http://symfony-project.org">symfony</a>.</p>
<p>Update the configuration file <code>config/ProjectConfiguration.class.php</code> to use the local <a href="http://symfony-project.org">symfony</a> version instead of the site-wide settings. </p>
<pre class="brush: php;">
require_once dirname(__FILE__) . '/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.rajatpandit.com/2009/07/11/symfony-development-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
