Skip to content


Subversion checkout URL

You can clone with
Download ZIP
124 lines (81 sloc) 3.67 KB


This is the official implementation of Propel in Symfony2.


The recommended way to install this bundle is to rely on Composer:

composer require propel/propel-bundle

Otherwise you can use Git, SVN, Git submodules, or the Symfony vendor management (deps file):

The second step is to register this bundle in the AppKernel class:

public function registerBundles()
    $bundles = array(
        // ...
        new Propel\PropelBundle\PropelBundle(),

    // ...

Don't forget to register the PropelBundle namespace in app/autoload.php if you are not using Composer:

    // ...
    'Propel' => __DIR__.'/../vendor/bundles',
    // ...
    'Phing'  => __DIR__.'/../vendor/phing/classes/phing',

You are almost ready, the next steps are:

Now, you can build your model classes, and SQL by running the following command:

> php app/console propel:build [--classes] [--sql] [--insert-sql] [--connection[=""]]

To insert SQL statements, use the propel:sql:insert command:

> php app/console propel:sql:insert [--force] [--connection[=""]]

Note that the --force option is needed to actually execute the SQL statements.

Congratulation! You're done, just use the Model classes as any other class in Symfony2:


class HelloController extends Controller
    public function indexAction($name)
        $author = new \Acme\DemoBundle\Model\Author();

        return $this->render('AcmeDemoBundle:Hello:index.html.twig', array(
            'name' => $name, 'author' => $author)

Now you can read more about:

Bundle Inheritance

The PropelBundle makes use of the bundle inheritance. Currently only schema inheritance is provided.

Schema Inheritance

You can override the defined schema of a bundle from within its child bundle. To make use of the inheritance you only need to drop a schema file in the Resources/config folder of the child bundle.

Each file can be overridden without interfering with other schema files. If you want to remove parts of a schema, you only need to add an empty schema file.

Jump to Line
Something went wrong with that request. Please try again.