Development

#2358 ([sfPropelActAsNestedSetBehaviorPlugin] [patch] Patch to make the plugin work with table from any propel database)

You must first sign up to be able to contribute.

Ticket #2358 (new defect)

Opened 1 year ago

Last modified 1 year ago

[sfPropelActAsNestedSetBehaviorPlugin] [patch] Patch to make the plugin work with table from any propel database

Reported by: Sylvio Assigned to: trivoallan
Priority: minor Milestone: plugins
Component: sfPropelActAsNestedSetBehaviorPlugin Version: 1.0.0
Keywords: Cc:
Qualification: Unreviewed

Description

Currently sfPropelActAsNestedSetBehaviorPlugin work only with On propel objects from table of the default propel database.

On propel objects from table of other databases, it cause errors when calling methods like getLevel() or getNumberOfChildren().

I can't publish a patch but this is the way to made sfPropelActAsNestedSetBehaviorPlugin able to work with the good database:

All the lines :

      $con = Propel::getConnection();

Have to be change with :

      $x=new ReflectionClass($peer_name);
      $con = Propel::getConnection($x->getConstant('DATABASE_NAME'));

I try using PeerInfo::getConstant() to get database name constant but it doesn't work in Symfony (because of Autoloading features).

Attachments

patch.txt (3.0 kB) - added by Sylvio on 10/10/07 20:12:49.
sfPropelActAsNestedSetBehavior.class.php Patch

Change History

10/10/07 00:44:11 changed by Sylvio

  • milestone set to plugins.

10/10/07 20:12:49 changed by Sylvio

  • attachment patch.txt added.

sfPropelActAsNestedSetBehavior.class.php Patch

10/10/07 20:16:36 changed by Sylvio

  • summary changed from sfPropelActAsNestedSetBehaviorPlugin Don't work with databases which are not propel default one to [sfPropelActAsNestedSetBehaviorPlugin] [patch] Patch to make the plugin work with table from any propel database.

I add a patch which correct the 4 propel connections to database in sfPropelActAsNestedSetBehavior class.

I need to add $node parameter to processStack(), processPreDeleteStack(), processPreSaveStack() methods in order to connect to the good database in processStack() method.