public static function create($conn = null, $class = null)
 {
     $q = new EstimateQuery($conn);
     $q->from('Estimate i')->orderBy('i.customer_name asc');
     $q->_model = 'Estimate';
     return $q;
 }
Beispiel #2
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $namespace = $request->getParameter('searchNamespace');
     $search = $this->getUser()->getAttribute('search', null, $namespace);
     $sort = $this->getUser()->getAttribute('sort', array('issue_date', 'desc'), $namespace);
     $page = $this->getUser()->getAttribute('page', 1, $namespace);
     $maxResults = $this->getUser()->getPaginationMaxResults();
     $q = EstimateQuery::create()->search($search)->orderBy("{$sort['0']} {$sort['1']}, number {$sort['1']}");
     // totals
     $this->gross = $q->total('gross_amount');
     $this->pager = new sfDoctrinePager('Estimate', $maxResults);
     $this->pager->setQuery($q);
     $this->pager->setPage($page);
     $this->pager->init();
     // this is for the redirect of the payments forms
     $this->getUser()->setAttribute('module', $request->getParameter('module'));
     $this->getUser()->setAttribute('page', $request->getParameter('page'));
     $this->sort = $sort;
 }