How can I properly switch the newly installed Symfony 1.4 framework from Doctrine (that it is configured for by default) to Propel?
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)
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.
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.
© 2022 - 2024 — McMap. All rights reserved.