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
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:
form:
class: TreeForm
Dla pewności jeszcze dołączę kod formularza
<?php
class TreeForm extends BaseTreeForm
{
protected $parentId = null;
public function configure()
{
unset($this['root_id'], $this['lft'], $this['rgt'], $this['level']); $this->widgetSchema['parent_id'] = new sfWidgetFormDoctrineChoice
(array( 'model' => 'tree',
'add_empty' => '~ (object is at root level)',
'order_by' => array('root_id, lft',''), 'method' => 'getIndentedName'
));
$this->validatorSchema['parent_id'] = new sfValidatorDoctrineChoice
(array( 'required' => false,
'model' => 'tree'
));
$this->setDefault('parent_id', $this->object->getParentId());
$this->widgetSchema->setLabel('parent_id', 'Child of');
}
public function updateParentIdColumn($parentId)
{
$this->parentId = $parentId;
// further action is handled in the save() method
}
protected function doSave($con = null)
{
parent::doSave($con);
$node = $this->object->getNode();
if ($this->parentId != $this->object->getParentId() || !$node->isValidNode())
{
if (empty($this->parentId)) {
//save as a root
if ($node->isValidNode())
{
$node->makeRoot($this->object['id']);
$this->object->save($con);
}
else
{
$this->object->getTable()->getTree()->createRoot($this->object); //calls $this->object->save internally
}
}
else
{
//form validation ensures an existing ID for $this->parentId
$parent = $this->object->getTable()->find($this->parentId);
$method = ($node->isValidNode() ? 'move' : 'insert') . 'AsFirstChildOf';
$node->$method($parent); //calls $this->object->save internally
}
}
}
}
Dziękuje z góry za odpowiedź
Ten post edytował muwie 4.05.2011, 23:44:56