| 1 |
Index: C:/Documents and Settings/Sylvain/workspace/sfPropelActAsNestedSetBehaviorPlugin/lib/sfPropelActAsNestedSetBehavior.class.php |
|---|
| 2 |
=================================================================== |
|---|
| 3 |
--- C:/Documents and Settings/Sylvain/workspace/sfPropelActAsNestedSetBehaviorPlugin/lib/sfPropelActAsNestedSetBehavior.class.php (revision 5454) |
|---|
| 4 |
+++ C:/Documents and Settings/Sylvain/workspace/sfPropelActAsNestedSetBehaviorPlugin/lib/sfPropelActAsNestedSetBehavior.class.php (working copy) |
|---|
| 5 |
@@ -74,7 +74,7 @@ |
|---|
| 6 |
*/ |
|---|
| 7 |
public function preSave(BaseObject $node) |
|---|
| 8 |
{ |
|---|
| 9 |
- $this->processPreSaveStack(); |
|---|
| 10 |
+ $this->processPreSaveStack($node); |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
/** |
|---|
| 14 |
@@ -110,12 +110,13 @@ |
|---|
| 15 |
self::getColumnConstant($node_class, 'parent'), |
|---|
| 16 |
$node->getPrimaryKey()); |
|---|
| 17 |
|
|---|
| 18 |
- $con = Propel::getConnection(); |
|---|
| 19 |
+ $x=new ReflectionClass($peer_name); |
|---|
| 20 |
+ $con = Propel::getConnection($x->getConstant('DATABASE_NAME')); |
|---|
| 21 |
$statement = $con->createStatement(); |
|---|
| 22 |
$statement->execute($query); |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
- $this->processPreDeleteStack(); |
|---|
| 26 |
+ $this->processPreDeleteStack($node); |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
# -- GETTERS AND SETTERS |
|---|
| 30 |
@@ -482,7 +483,8 @@ |
|---|
| 31 |
public function getNumberOfChildren(BaseObject $node) |
|---|
| 32 |
{ |
|---|
| 33 |
$peer_name = get_class($node->getPeer()); |
|---|
| 34 |
- $con = Propel::getConnection(); |
|---|
| 35 |
+ $x=new ReflectionClass($peer_name); |
|---|
| 36 |
+ $con = Propel::getConnection($x->getConstant('DATABASE_NAME')); |
|---|
| 37 |
$scope_sql = ''; |
|---|
| 38 |
if (!is_null($node->getScopeIdValue())) |
|---|
| 39 |
{ |
|---|
| 40 |
@@ -532,7 +534,8 @@ |
|---|
| 41 |
{ |
|---|
| 42 |
$peer_name = get_class($node->getPeer()); |
|---|
| 43 |
|
|---|
| 44 |
- $con = Propel::getConnection(); |
|---|
| 45 |
+ $x=new ReflectionClass($peer_name); |
|---|
| 46 |
+ $con = Propel::getConnection($x->getConstant('DATABASE_NAME')); |
|---|
| 47 |
$stmt = $con->createStatement(); |
|---|
| 48 |
|
|---|
| 49 |
$scope_sql = ''; |
|---|
| 50 |
@@ -1051,7 +1054,7 @@ |
|---|
| 51 |
/** |
|---|
| 52 |
* Processes presave stack : runs stacked queries and saves stackes objects. |
|---|
| 53 |
*/ |
|---|
| 54 |
- private function processStack($stack_name) |
|---|
| 55 |
+ private function processStack($stack_name, $node) |
|---|
| 56 |
{ |
|---|
| 57 |
foreach ($this->$stack_name as $action) |
|---|
| 58 |
{ |
|---|
| 59 |
@@ -1065,7 +1068,8 @@ |
|---|
| 60 |
// stack entry is an sql query, let's execute it |
|---|
| 61 |
elseif (is_string($action)) |
|---|
| 62 |
{ |
|---|
| 63 |
- $con = Propel::getConnection(); |
|---|
| 64 |
+ $x=new ReflectionClass(get_class($node->getPeer())); |
|---|
| 65 |
+ $con = Propel::getConnection($x->getConstant('DATABASE_NAME')); |
|---|
| 66 |
$statement = $con->createStatement(); |
|---|
| 67 |
$result = $statement->executeQuery($action); |
|---|
| 68 |
} |
|---|
| 69 |
@@ -1078,14 +1082,14 @@ |
|---|
| 70 |
} |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
- private function processPreDeleteStack() |
|---|
| 74 |
+ private function processPreDeleteStack($node) |
|---|
| 75 |
{ |
|---|
| 76 |
- $this->processStack('predelete_stack'); |
|---|
| 77 |
+ $this->processStack('predelete_stack',$node); |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
- private function processPreSaveStack() |
|---|
| 81 |
+ private function processPreSaveStack($node) |
|---|
| 82 |
{ |
|---|
| 83 |
- $this->processStack('presave_stack'); |
|---|
| 84 |
+ $this->processStack('presave_stack',$node); |
|---|
| 85 |
} |
|---|
| 86 |
|
|---|
| 87 |
/** |
|---|