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>

At line no 79.
$this->$planbooks->getPlanbook();
should be
$this->planbooks->getPlanbook();

hi,

i did,but still this error was comming.plz help me.

500 | Internal Server Error | Doctrine_Table_Exception
Unknown method PlanbookTable::getPlanbook
stack trace

    at ()
    in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Table.php line 2856 ...
                        return call_user_func_array(array($this->getRecordInstance(), $method . 'TableProxy'), $arguments);
                    } catch (Doctrine_Record_UnknownPropertyException $e) {}
                    throw new Doctrine_Table_Exception(sprintf('Unknown method %s::%s', get_class($this), $method));
                }
            }

Have you created all classes by your own?
Where is getPlanbook function defined?

Hi every thing is my own class.i used symfony doctrine form creation.My table name is Planbook.now i have problem in how to view datas in index page.you have solution.plz tell me.how to view all the datas in indexpage.
no doubt all the class in my own class.i am new in php and symfony.

getPlanbook

Sorry i don't know symfony.
But trying.. Add below function in PlanbookTable class.

public function getPlanbook()
    {
       return Doctrine::getTable("Planbook")->findAll;       
    }

Thnaks for ur reply. that error was solved.but still no data display in index page.what is the problem.plz help me.how to view data in index page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.