Doctrine 1
  1. Doctrine 1
  2. DC-375

Doctrine_Table getTable singleton issue

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0.14
    • Fix Version/s: None
    • Component/s: Connection
    • Labels:
      None
    • Environment:
      symfony 1.2.9

      Description

      first, i defined a table class :
      class CohibaClientTable extends Doctrine_Table
      {
      public $_pager;

      public function getAbstractList($arrParam = array(), $page=1, $maxPerPage=20)
      {
      $objQuery = $this->createQuery('t1')
      ->select('t1.*');

      if(is_array($arrParam) && count($arrParam)>0)

      { QueryAssistant::processOption($objQuery, $arrParam); // dont set "offset" and "limit" option in it }

      $this->_pager = new Doctrine_Pager($objQuery, $page, $maxPerPage);

      $items = $this->_pager->execute();

      $objQuery->free();
      return $items;
      }

      public function getList($page=1, $maxPerPage=20)

      { $arrParam = array( 'orderBy'=>'t1.cle asc' ); return $this->getAbstractList($arrParam, $page, $maxPerPage); }

      public function getPager()

      { return $this->_pager; }

      }

      and then, in the action, invoke it like this codes:
      1>
      $items = Doctrine::getTable("CohibaClient")->getList(1, $maxPerPage);
      $pager = Doctrine::getTable("CohibaClient")->getPager();

      $this->log("total records: ".$pager->getNumResults()." total page: ".$pager->getLastPage()."\n");
      $lastPage = $pager->getLastPage();
      2>
      $table = Doctrine::getTable("CohibaClient");
      $items = $table->getList(1, $maxPerPage);
      $pager = $table->getPager();

      $this->log("total records: ".$pager->getNumResults()." total page: ".$pager->getLastPage()."\n");
      $lastPage = $pager->getLastPage();

      #2 works, but not #1, error is "Fatal error: Call to a member function getNumResults() on a non-object in.... " is it an issue when singleton generation?

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            ben bi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: