Created
May 28, 2010 11:12
-
-
Save snakewa/417043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This patch file was generated by NetBeans IDE | |
| # It uses platform neutral UTF-8 encoding and \n newlines. | |
| --- ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php | |
| +++ ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php | |
| @@ -30,7 +30,8 @@ | |
| 'newFormsContainerForm' => null, // pass BaseForm object here or we will create ahNewRelationsContainerForm | |
| 'newRelationButtonLabel' => '+', | |
| 'newRelationAddByCloning' => true, | |
| - 'newRelationUseJSFramework' => 'jQuery' | |
| + 'newRelationUseJSFramework' => 'jQuery', | |
| + 'father_key' => null | |
| ); | |
| protected function addDefaultRelationSettings(array $settings) | |
| @@ -374,7 +375,7 @@ | |
| */ | |
| private function embeddedFormFactory($relationName, array $relationSettings, Doctrine_Relation $relation, $formLabel = null) | |
| { | |
| - $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation); | |
| + $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation , $relationSettings['father_key']); | |
| $formClass = empty($relationSettings['newFormClass']) ? $relation->getClass().'Form' : $relationSettings['newFormClass']; | |
| $formArgs = empty($relationSettings['newFormClassArgs']) ? array() : $relationSettings['newFormClassArgs']; | |
| $r = new ReflectionClass($formClass); | |
| @@ -408,13 +409,17 @@ | |
| * @param Doctrine_Relation $relation | |
| * @return Doctrine_Record | |
| */ | |
| - private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation) | |
| + private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation , $father_key = null) | |
| { | |
| if (Doctrine_Relation::MANY === $relation->getType()) | |
| { | |
| $newFormObjectClass = $relation->getClass(); | |
| $newFormObject = new $newFormObjectClass(); | |
| - $newFormObject[get_class($this->getObject())] = $this->getObject(); | |
| + | |
| + if(!$father_key){ | |
| + $father_key = get_class($this->getObject()); | |
| + } | |
| + $newFormObject[$father_key] = $this->getObject(); | |
| } else | |
| { | |
| $newFormObject = $this->getObject()->$relationName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment