Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch symfony 1.4 from Doctrine to Propel

How can I properly switch the newly installed Symfony 1.4 framework from Doctrine (that it is configured for by default) to Propel?

like image 843
Stepashka Avatar asked Dec 02 '09 20:12

Stepashka


4 Answers

If you create new (fresh) project...

symfony generate:project xxx --orm=Propel

The easiest thing :)

If you want to change existing project - you have to dig in configuration file and enable propel plugin.

Your configuration file should look similar to:

// config/ProjectConfiguration.class.php
public function setup()
{
  $this->enablePlugins('sfPropelPlugin');
  ...
}

(based on Symfony page, you should dig it next time - especially Practical Symfony)

like image 128
Tomasz Struczyński Avatar answered Nov 15 '22 19:11

Tomasz Struczyński


Use Propel if you enjoy object-oriented syntax.

like image 42
Jesse Avatar answered Nov 15 '22 19:11

Jesse


If you like chained object method calls that look like SQL statements, use Doctrine. If you like real objects that hide SQL, use Propel.

If you like creating criteria objects that then render themselves as WHERE clauses, use Propel. If you like creating WHERE clauses similar to SQL, use Doctrine.

You can use both at the same time, too. Not recommended, but if you use plugins like apostrophe that only use Doctrine, you might not have a choice.

like image 33
notbrain Avatar answered Nov 15 '22 21:11

notbrain


Replying to the contributors here who wholly recommend Doctrine: the decision is not clear cut, in my view. Propel now also supports chainable query methods, so if you like that approach then both are still in play. Also, the Propel team maintain that the generated nature of model objects makes it faster to run for most use-cases than Doctrine.

like image 37
halfer Avatar answered Nov 15 '22 21:11

halfer