Hi everybody,
I have this error.anybody,plz help me.how to solve this problem.
store all the data in database.but view the data in index page.
nothing to display.
lib/model/doctrine:
class PlanbookTable extends Doctrine_Table
public function updatePlanbook($data)
{
if ($data["id"]) {
$planbook = Doctrine::getTable("Planbook")->find
($data["id"]);
}
else {
$planbook = new Planbook();
}
$planbook->saveDataInArray($data);
}
}
lib/model/doctrin
class Planbook extends BasePlanbook
{
public function getDataInArray()
{
$data = array();
$data['personal_id'] = $this->personal_id;
$data['title_name'] = $this->title_name;
$data['photo'] = $this->photo;
$data['country_id'] = $this->country_id;
$data['zone_id'] = $this->zone_id;
$data['place'] = $this->place;
$data['occasion'] = $this->occasion;
$data['itinerary'] = $this->itinerary;
$data['description'] = $this->description;
$data['date'] = $this->date;
return $data;
}
public function saveDataInArray($data)
{
$this->title_name = $data['title_name'];
$this->photo = $data['photo'];
$this->country_id = $data['country_id'];
$this->zone_id = $data['zone_id'] == '' ? null : $data['zone_id'];
$this->place = $data['place'];
$this->occasion = $data['occasion'];
$this->itinerary = $data['itinerary'];
$this->description = $data['description'];
$this->date = $data['date'];
$this->save();
}
}
class planbookActions extends sfActions
{
public function executeIndex(sfWebRequest $request)
{
$this->planbooks = Doctrine_Core::getTable('Planbook');
$this->planbook = Doctrine_Core::getTable('Planbook')->find(array
($request->getParameter('id')));
if($personal_id==$this->getUser()->getAttribute('detail')
){
$this->planbooks = Doctrine::getTable('Planbook');
$this->$planbooks->getPlanbook();
}
}
public function executeEdit(sfWebRequest $request)
{
$planbook = Doctrine_Core::getTable('Planbook')->find(array($request-
>getParameter('id')));
$this->form = new PlanbookForm($planbook);
if($request->isMethod("post"))
{
//get the submitted values
$planbook=$request->getParameter("planbook");
//check total error
if(count($error)==0) {
Doctrine::getTable("Planbook")->updatePlanbook($planbook);
}
}
else
{
$planbook=Doctrine::getTable("Planbook")->find($request->getParameter
("id"));
$planbook = $planbook->getDataInArray();
}
$this->planbook=$planbook;
$this->error=$error;
}
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request-
>isMethod(sfRequest::PUT));
$planbook = Doctrine_Core::getTable('Planbook')->find(array($request-
>getParameter('id')));
// $this->form = new PlanbookForm($planbook);
// $this->processForm($request, $this->form);
$result=$this->processForm($request);
return $this->renderText($result);
$this->setTemplate('edit');
}
indexsuccess.php
<ul class="planbook-list" >
<?php foreach ($planbooks as $planbook): ?>
<li class="planbook-item">
<div class="clear-both"></div>
<?php echo $planbook->getTitleName() ?>
.....
....
<?php echo $planbook->getDescription() ?>
</li>
<?php endforeach ?>
</ul>