Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] W jaki sposób w gneratorze dodać własny formularz
muwie
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 1
Dołączył: 21.02.2007
Skąd: Milejów

Ostrzeżenie: (0%)
-----


Witam.
Chciałbym dołączyć własny formularz do admin generatora.
Otóż przerabiam ten tutorial.
Wszystkie pliki mam już zrobione.
Ale nie wiem czy dobrze dołączyłem własny formularz, bo wywala mi poniższy bład

  1. Fatal error: Class 'BaseTreeForm' not found in C:\xampp\htdocs\cms\lib\form\doctrine\TreeForm.class.php on line 3


A dołączam formularz w taki sposób:

  1. form:
  2. class: TreeForm


Dla pewności jeszcze dołączę kod formularza
  1. <?php
  2. class TreeForm extends BaseTreeForm
  3. {
  4. protected $parentId = null;
  5.  
  6. public function configure()
  7. {
  8. unset($this['root_id'], $this['lft'], $this['rgt'], $this['level']);
  9. $this->widgetSchema['parent_id'] = new sfWidgetFormDoctrineChoice(array(
  10. 'model' => 'tree',
  11. 'add_empty' => '~ (object is at root level)',
  12. 'order_by' => array('root_id, lft',''),
  13. 'method' => 'getIndentedName'
  14. ));
  15. $this->validatorSchema['parent_id'] = new sfValidatorDoctrineChoice(array(
  16. 'required' => false,
  17. 'model' => 'tree'
  18. ));
  19. $this->setDefault('parent_id', $this->object->getParentId());
  20. $this->widgetSchema->setLabel('parent_id', 'Child of');
  21. }
  22.  
  23. public function updateParentIdColumn($parentId)
  24. {
  25. $this->parentId = $parentId;
  26. // further action is handled in the save() method
  27. }
  28.  
  29. protected function doSave($con = null)
  30. {
  31. parent::doSave($con);
  32.  
  33. $node = $this->object->getNode();
  34.  
  35. if ($this->parentId != $this->object->getParentId() || !$node->isValidNode())
  36. {
  37. if (empty($this->parentId))
  38. {
  39. //save as a root
  40. if ($node->isValidNode())
  41. {
  42. $node->makeRoot($this->object['id']);
  43. $this->object->save($con);
  44. }
  45. else
  46. {
  47. $this->object->getTable()->getTree()->createRoot($this->object); //calls $this->object->save internally
  48. }
  49. }
  50. else
  51. {
  52. //form validation ensures an existing ID for $this->parentId
  53. $parent = $this->object->getTable()->find($this->parentId);
  54. $method = ($node->isValidNode() ? 'move' : 'insert') . 'AsFirstChildOf';
  55. $node->$method($parent); //calls $this->object->save internally
  56. }
  57. }
  58. }
  59. }

Dziękuje z góry za odpowiedź

Ten post edytował muwie 4.05.2011, 23:44:56
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 00:20