Switch symfony 1.4 from Doctrine to Propel
Asked Answered
M

4

5

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

Mullein answered 2/12, 2009 at 20:44 Comment(0)
W
7

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)

Weird answered 3/12, 2009 at 13:59 Comment(6)
BTW, if you're starting new project, I strongly recommend Doctrine. It's better.Panayiotis
I agree with Tomasz. Don't use Propel.Aglitter
and Priidik: at least please give a few arguments, links etc. telling precisely why Doctrine is better than Propel (however after more than one year, arguments have certainly changed...).Lye
As a quick comment - it's probably better for Symfony as it is now the default ORM in Symfony and both teams works closely. At times I did research, Doctrine was much more actively developed (although Propel development fasten since that).Panayiotis
I did the changes you mentioned, but after building the Propel DB, I get an error that "could no open propel.ini". In fact, I don't have that file (nevertheless, I have the doctrine.ini so, I guess, it was created when building all the project). Is there a way to fix this without creating a new project?. So far, haven't created tables in the DB. (EDIT:I'm using Symfony 1.4) (Also, following, but backwards this: trac.symfony-project.org/wiki/ConvertingPropelProjectToDoctrine)Weiman
I guess you should create propel.ini file. You can find the skeleton in folder lib/plugins/sfPropelPlugin/config/skeleton/config/propel.ini of your symfony installation - or here: trac.symfony-project.org/browser/branches/1.4/lib/plugins/…Panayiotis
V
5

Use Propel if you enjoy object-oriented syntax.

Vegetarianism answered 6/1, 2010 at 8:17 Comment(0)
F
5

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.

Forsook answered 20/9, 2010 at 5:15 Comment(0)
R
1

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.

Rook answered 29/9, 2011 at 18:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.