PHPackages                             trindade/my-sf-propel-o-r-m-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. trindade/my-sf-propel-o-r-m-plugin

ActiveSymfony1-plugin[Database &amp; ORM](/categories/database)

trindade/my-sf-propel-o-r-m-plugin
==================================

my symfony 1.x plugin for Propel.

1.5.0(6y ago)051PHP

Since Jun 18Pushed 6y agoCompare

[ Source](https://github.com/trindade/sfPropelORMPlugin)[ Packagist](https://packagist.org/packages/trindade/my-sf-propel-o-r-m-plugin)[ Docs](http://www.propelorm.org/)[ RSS](/packages/trindade-my-sf-propel-o-r-m-plugin/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (2)Used By (1)

sfPropelORMPlugin
=================

[](#sfpropelormplugin)

[![Build Status](https://camo.githubusercontent.com/67320c60b96f8309e8cb6881cb24a2e80ba2ead512a9788a368217254ac9470e/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f70726f70656c6f726d2f736650726f70656c4f524d506c7567696e2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/propelorm/sfPropelORMPlugin)

Replaces symfony's core Propel plugin by the latest version of Propel, in branch 1.6.

Installation
------------

[](#installation)

### The Composer way

[](#the-composer-way)

Add the require to your composer.json. It's oddly named but like this Composer's symfony1 installer camelcases it correctly. Composer will install it into your project's plugins directory automatically, and add the requirements.

```
{
    "config": {
        "vendor-dir": "lib/vendor"
    },
    "require": {
        "propel/sf-propel-o-r-m-plugin": "dev-master"
    }
}

```

Of course, don't forget to add Composer's autoloader to your ProjectConfiguration:

```
// config/ProjectConfiguration.class.php

require __DIR__ .'/../lib/vendor/autoload.php';

require_once dirname(__FILE__) .'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
    public function setup()
    {
        $this->enablePlugins(array(
            'sfPropelORMPlugin',
            ...
        ));

        // mandatory because of the Composer vendor directory naming scheme
        sfConfig::set('sf_phing_path', sfConfig::get('sf_lib_dir') .'/vendor/phing/phing');
        sfConfig::set('sf_propel_path', sfConfig::get('sf_lib_dir') .'/vendor/propel/propel1');
    }
}
```

### The Git way

[](#the-git-way)

Clone the plugin from Github:

```
git clone git://github.com/propelorm/sfPropelORMPlugin.git plugins/sfPropelORMPlugin
cd plugins/sfPropelORMPlugin
git submodule update --init

```

If you use Git as a VCS for your project, it should be better to add the plugin as a submodule:

```
git submodule add git://github.com/propelorm/sfPropelORMPlugin.git plugins/sfPropelORMPlugin
git submodule update --init --recursive

```

As both Phing and Propel libraries are bundled with the plugin, you have to initialize submodules for the plugin.

### The SVN way

[](#the-svn-way)

Install the plugin via the subversion repository:

```
svn checkout https://github.com/propelorm/sfPropelORMPlugin/trunk plugins/sfPropelORMPlugin

```

Install `Phing` and `Propel`:

```
svn checkout http://phing.mirror.svn.symfony-project.com/tags/2.3.3/classes/phing lib/vendor/phing
svn checkout https://github.com/propelorm/Propel/tags/1.6.5 lib/vendor/propel

```

### Final step

[](#final-step)

Disable the core Propel plugin and enable the `sfPropelORMPlugin` instead. Also, change the location for the Propel and Phing libs.

```
// config/ProjectConfiguration.class.php

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    //setup the location for our phing and propel libs
    sfConfig::set('sf_phing_path', sfConfig::get('sf_root_dir').'/plugins/sfPropelORMPlugin/lib/vendor/phing/');
    sfConfig::set('sf_propel_path', sfConfig::get('sf_root_dir').'/plugins/sfPropelORMPlugin/lib/vendor/propel/');
    sfConfig::set('sf_propel_generator_path', sfConfig::get('sf_root_dir').'/plugins/sfPropelORMPlugin/lib/vendor/propel/generator/lib/');

    $this->enablePlugins('sfPropelORMPlugin');
  }
}
```

**Optional:** update references to the `propel` and `phing` folders in the test project.

```
// plugins/sfPropelORMPlugin/test/functional/fixtures/config/ProjectConfiguration.class.php

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins(array('sfPropelORMPlugin'));
    $this->setPluginPath('sfPropelORMPlugin', realpath(dirname(__FILE__) . '/../../../..'));

    // SVN way
    //sfConfig::set('sf_propel_path', SF_DIR.'/../lib/vendor/propel');
    //sfConfig::set('sf_phing_path', SF_DIR.'/../lib/vendor/phing');

    // Git way
    sfConfig::set('sf_propel_path', realpath(dirname(__FILE__) . '/../../../../lib/vendor/propel'));
    sfConfig::set('sf_phing_path', realpath(dirname(__FILE__) . '/../../../../lib/vendor/phing'));
  }
```

Right after the installation of the plugin, you should update plugin assets:

```
php symfony plugin:publish-assets

```

Change the path of the symfony behaviors in the `config/propel.ini` file of your project:

```
// config/propel.ini

propel.behavior.symfony.class                  = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfony
propel.behavior.symfony_i18n.class             = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18n
propel.behavior.symfony_i18n_translation.class = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorI18nTranslation
propel.behavior.symfony_behaviors.class        = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
propel.behavior.symfony_timestampable.class    = plugins.sfPropelORMPlugin.lib.behavior.SfPropelBehaviorTimestampable
```

(Re)Build the model:

```
php symfony propel:build --all-classes

```

What's New In Propel 1.6
------------------------

[](#whats-new-in-propel-16)

Propel 1.6 is a **backwards compatible** evolution of Propel 1.4 (the version bundled with symfony 1.3 and 1.4), which adds some very interesting features. Among these features, you will find the **new Propel Query API**, which is essentially a Criteria on steroids:

```
// find the 10 latest books published by authror 'Leo'
$books = BookQuery::create()
    ->useAuthorQuery()
    ->filterByFirstName('Leo')
    ->endUse()
    ->orderByPublishedAt('desc')
    ->limit(10)
    ->find($con);
```

Propel 1.6 also supports **many-to-many relationships**, **collections**, **on-demand hydration**, **new core behaviors** (see below), better Oracle support, and is now licensed under the MIT license.

Core Propel Behaviors
---------------------

[](#core-propel-behaviors)

Propel 1.6 bundles most common behaviors in a new, robust buildtime implementation. These core behaviors provide faster runtime execution and the ability to modify the data model:

- [timestampable](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/timestampable)
- [sluggable](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/sluggable)
- soft\_delete
- [nested\_set](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/nested_set)
- [sortable](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/sortable)
- [concrete\_inheritance](http://www.propelorm.org/wiki/Documentation/1.6/Inheritance#ConcreteTableInheritance)
- [query\_cache](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/query_cache)
- [alternative\_coding\_standards](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/alternative_coding_standards)
- [auto\_add\_pk](http://www.propelorm.org/wiki/Documentation/1.6/Behaviors/auto_add_pk)

`sfPropelORMPlugin` allows you to register core propel behaviors right from your `schema.yml`. For instance, to create a tree structure from a `Section` model:

```
propel:
    section:
    _attributes: { phpName: Section }
    _propel_behaviors:
        - nested_set
    id: ~
    title: { type: varchar(100), required: true primaryString: true }
```

**Tip**: Check the [`doc/schema.md`](https://raw.github.com/propelorm/sfPropelORMPlugin/master/doc/schema.md) file in this plugin source code for a complete reference of the YAML schema format.

You can also register a behavior for all your models right in the `propel.ini` configuration file. `sfPropelORMPlugin` already enables the `symfony` and `symfony_i18n` behaviors to support symfony's behavior system and model localization features, but you can easily add your owns:

```
propel.behavior.default = symfony,symfony_i18n,alternative_coding_standards,auto_add_pk
```

Admin Generator Extensions
--------------------------

[](#admin-generator-extensions)

The plugin comes bundled with a new admin generator theme named 'admin15'. This theme is backwards compatible with sfPropelPlugin's admin generator theme, and provides additional features based on the new Propel 1.6 query objects:

### List view enhancements

[](#list-view-enhancements)

- **Easy related objects hydration**: You don't need to write custom `doSelectJoinXXX()` methods to hydrate related objects. The `with` setting is much more poxwerful that the previous `peer_method` and `peer_count_method` settings, and much easier to use.
- **Custom query methods**: You can refine the query executed to display the list view by by setting the `query_methods` parameter. This allows to hydrate an additional column wit hno additional query, or to pre-filter the list to hide rows that the user shouldn't see.
- **All columns are sortable**: Virtual columns and foreign key columns are now sortable in the list view. You'll need to set the sort method to use for that, but it's a one-liner. No more lists with column headers that can't be clicked for sorting!
- **Easy links to filtered lists**: A link to a fitlered list view is very easy to write with the new theme. Just add GET parameter, the same way you used to do with the admin generator in symfony 1.2, and it works
- **Links to another admin module**: To make a foreign key column link to the edit view of the related object in another module, you no longer need to create a partial. Just define the `link_module` setting in the foreign key field configuration, and you're good to go:
- **Easy custom filters**: Adding custom filters becomes very easy once you can take advantage of the generated Propel query classes. This allows your, for instance, to setup a full-text search input in two minutes, replacing many text filters by a single one for better usability.
- **Automatic sortable links**: If a module is generated on a model with sortable behavior, actions for moving records up and down are automatically added.

### Filter and Edit forms enhancement

[](#filter-and-edit-forms-enhancement)

- **YAML widget customization**: The `generator.yml` format was extended to allow widget and validator customization directly in YAML, without the need to edit a form object. You can also safely omit a field from a `display` list in a form definition, without any risk to loose data.
- **Plain text field**: If you want to display some data in a form without allowing the user to edit it, use the `type: plain` attribute, just like in the old days of symfony 1.2. This is very useful for columns managed by the model, like `created_at` and `updated_at` columns.

The new options for the `admin15` generator theme are fully documented, and illustrated by real life examples, in the [`doc/admin_generator.md`](https://raw.github.com/propelorm/sfPropelORMPlugin/master/doc/admin_generator.md) file in this plugin source code.

Form Subframework Modifications
-------------------------------

[](#form-subframework-modifications)

- **Updated `sfWidgetFormPropelChoice` widget**: The widget now uses the new Query API. You can customize the list of choices more easily by executing custom query methods, using the new `query_methods` option.
- **Updated Propel validators**: Both the `sfValidatorPropelChoice` and the `sfValidatorPropelUnique` were updated to use the new PropelQuery objects, and to accept a `query_methods` option similar to the one of `sfWidgetFormPropelChoice`.
- **Plain text widget and validator**: This new widget allows a field to be displayed in a form, without letting the use change it.
- **Easy Relation Embed**: Editing related objects together with the main objects (e.g., editing `Comments` in a `Post` form) is a piece of cake. The new `sfFormPropel::embedRelation()` method does all the work to fetch related objects, build the forms for each of them, and embed the related object forms into the main form. Embdeded relation forms allow to **edit**, **add**, and **delete** a related objects with no additional code.

```
class ArticleForm extends BaseArticleForm
{
  public function configure()
  {
    $this->embedRelation('Book');
  }
}
```

The Propel widgets, validators, and form classes are fully documented in the [`doc/form.md`](https://raw.github.com/propelorm/sfPropelORMPlugin/master/doc/form.md) file in this plugin source code.

Filter Subframework modification
--------------------------------

[](#filter-subframework-modification)

You now can merge or embed filters into filters, it works out of the box.

```
class ArticleFilter extends BaseArticleFilter
{
  public function configure()
  {
    $this->mergeForm(new AuthorFilter());
  }
}
```

Routing Modifications
---------------------

[](#routing-modifications)

The plugin offer two new routing classes, `sfPropelORMRoute` and `sfPropelORMRouteCollection`. These classes are used by default in the models build with the propel admin generator. They behave just like the previous `sfPropelRoute` class - except they don't use the `methods` option anymore. Instead, use the `query_methods` option to execute a list of arbitrary query methods when calling `getObject()` and `getObjects()`.

```
author:
    class: sfPropelORMRouteCollection
    options:
    model:                author
    module:               author
    prefix_path:          /author
    column:               id
    query_methods:
        object: [filterByIsPublished]
        list:   [filterByIsPublished, orderByLastName]
    with_wildcard_routes: true
```

Array of additional parameters are also possible for `query_methods`:

```
author:
    class: sfPropelORMRouteCollection
    options:
    model:                author
    module:               author
    prefix_path:          /author
    column:               id
    query_methods:
        object:
        filterByIsPublished: [false]
        list:
        filterByIsPublished: []
        orderBy:             [LastName]
    with_wildcard_routes: true
```

`sfPropelORMRoute` also makes your code a little easier to read in the action. Instead of calling `getObject()`, you can actually call a getter using the class name of the object's route:

```
public function executeShow(sfWebRequest $request)
{
    // using sfPropelORMRoute with 'Author' as model
    $this->author = $this->getRoute()->getAuthor();
}
```

A new option has been added to both `sfPropelORMRoute` and `sfPropelORMRouteCollection`, the `connection` option allows to set a specific Propel connection to use. Examples:

```
author_show:
  url:     /author/:id
  class:   sfPropelORMRoute
  param:   { module: myModule, action: show }
  options: { model: Author, type: object, connection: my_connection }
```

```
author:
    class: sfPropelORMRouteCollection
    options:
    model:                Author
    module:               author
    prefix_path:          /author
    column:               id
    connection:           my_connection
    with_wildcard_routes: true
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2520d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cff98498b886a130ca81db017322077ddf450fa9ff638503120f5a5c06d6bc5e?d=identicon)[trindade](/maintainers/trindade)

---

Top Contributors

[![willdurand](https://avatars.githubusercontent.com/u/217628?v=4)](https://github.com/willdurand "willdurand (116 commits)")[![fzaninotto](https://avatars.githubusercontent.com/u/99944?v=4)](https://github.com/fzaninotto "fzaninotto (44 commits)")[![rozwell](https://avatars.githubusercontent.com/u/695221?v=4)](https://github.com/rozwell "rozwell (28 commits)")[![matteosister](https://avatars.githubusercontent.com/u/212723?v=4)](https://github.com/matteosister "matteosister (18 commits)")[![themouette](https://avatars.githubusercontent.com/u/245501?v=4)](https://github.com/themouette "themouette (16 commits)")[![jaugustin](https://avatars.githubusercontent.com/u/564420?v=4)](https://github.com/jaugustin "jaugustin (12 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (8 commits)")[![mazenovi](https://avatars.githubusercontent.com/u/366957?v=4)](https://github.com/mazenovi "mazenovi (8 commits)")[![VanTanev](https://avatars.githubusercontent.com/u/202527?v=4)](https://github.com/VanTanev "VanTanev (7 commits)")[![cedriclombardot](https://avatars.githubusercontent.com/u/651484?v=4)](https://github.com/cedriclombardot "cedriclombardot (6 commits)")[![simitter](https://avatars.githubusercontent.com/u/340021?v=4)](https://github.com/simitter "simitter (6 commits)")[![e1himself](https://avatars.githubusercontent.com/u/370680?v=4)](https://github.com/e1himself "e1himself (5 commits)")[![javer](https://avatars.githubusercontent.com/u/591296?v=4)](https://github.com/javer "javer (4 commits)")[![ldath](https://avatars.githubusercontent.com/u/64095?v=4)](https://github.com/ldath "ldath (4 commits)")[![lucasaba](https://avatars.githubusercontent.com/u/206325?v=4)](https://github.com/lucasaba "lucasaba (4 commits)")[![hd-deman](https://avatars.githubusercontent.com/u/705532?v=4)](https://github.com/hd-deman "hd-deman (4 commits)")[![ksn135](https://avatars.githubusercontent.com/u/230304?v=4)](https://github.com/ksn135 "ksn135 (3 commits)")[![xophm1](https://avatars.githubusercontent.com/u/266237?v=4)](https://github.com/xophm1 "xophm1 (2 commits)")[![casivaagustin](https://avatars.githubusercontent.com/u/95085603?v=4)](https://github.com/casivaagustin "casivaagustin (2 commits)")[![gries](https://avatars.githubusercontent.com/u/417823?v=4)](https://github.com/gries "gries (2 commits)")

---

Tags

symfonypersistencedatabaseormmappingactive-recordpropel

### Embed Badge

![Health badge](/badges/trindade-my-sf-propel-o-r-m-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/trindade-my-sf-propel-o-r-m-plugin/health.svg)](https://phpackages.com/packages/trindade-my-sf-propel-o-r-m-plugin)
```

###  Alternatives

[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8481.6M87](/packages/propel-propel1)[propel/propel-bundle

Integration of Propel in Symfony

181905.3k53](/packages/propel-propel-bundle)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

203.7k](/packages/perplorm-perpl)[proesio/pipe

PIPE - ORM en Español.

139.2k1](/packages/proesio-pipe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
