public function executeProduct(sfWebRequest $request)
 {
     //возвращаем объект json для нашего фронтенд
     // заголовок
     $this->getResponse()->setContentType('application/json');
     //реализован ОРМ Пропел, испотльзуем его прелести + дописаные кастомные методы;
     $productID = $request->getParameter('id');
     $product = ProductPeer::retrieveByPK($productID);
     if (is_object($product)) {
         $result = ProductPeer::getProductDetails($productID);
     } else {
         $result = array();
     }
     $data_json = json_encode($result);
     return $this->renderText($data_json);
 }
Example #2
0
 public function getProduct($con = null)
 {
     if ($this->aProduct === null && $this->id !== null) {
         include_once 'lib/model/om/BaseProductPeer.php';
         $this->aProduct = ProductPeer::retrieveByPK($this->id, $con);
     }
     return $this->aProduct;
 }