Guest User

Untitled

a guest
May 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. # This patch file was generated by NetBeans IDE
  2. # It uses platform neutral UTF-8 encoding and \n newlines.
  3. --- ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
  4. +++ ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
  5. @@ -30,7 +30,8 @@
  6. 'newFormsContainerForm' => null, // pass BaseForm object here or we will create ahNewRelationsContainerForm
  7. 'newRelationButtonLabel' => '+',
  8. 'newRelationAddByCloning' => true,
  9. - 'newRelationUseJSFramework' => 'jQuery'
  10. + 'newRelationUseJSFramework' => 'jQuery',
  11. + 'father_key' => null
  12. );
  13.  
  14. protected function addDefaultRelationSettings(array $settings)
  15. @@ -374,7 +375,7 @@
  16. */
  17. private function embeddedFormFactory($relationName, array $relationSettings, Doctrine_Relation $relation, $formLabel = null)
  18. {
  19. - $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation);
  20. + $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation , $relationSettings['father_key']);
  21. $formClass = empty($relationSettings['newFormClass']) ? $relation->getClass().'Form' : $relationSettings['newFormClass'];
  22. $formArgs = empty($relationSettings['newFormClassArgs']) ? array() : $relationSettings['newFormClassArgs'];
  23. $r = new ReflectionClass($formClass);
  24. @@ -408,13 +409,17 @@
  25. * @param Doctrine_Relation $relation
  26. * @return Doctrine_Record
  27. */
  28. - private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation)
  29. + private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation , $father_key = null)
  30. {
  31. if (Doctrine_Relation::MANY === $relation->getType())
  32. {
  33. $newFormObjectClass = $relation->getClass();
  34. $newFormObject = new $newFormObjectClass();
  35. - $newFormObject[get_class($this->getObject())] = $this->getObject();
  36. +
  37. + if(!$father_key){
  38. + $father_key = get_class($this->getObject());
  39. + }
  40. + $newFormObject[$father_key] = $this->getObject();
  41. } else
  42. {
  43. $newFormObject = $this->getObject()->$relationName;
Add Comment
Please, Sign In to add comment