FavoriteService::count PHP Метод

count() публичный Метод

public count ( )
    public function count()
    {
        return count($this->getData());
    }

Usage Example

Пример #1
0
 /**
  * @throws CHttpException
  */
 public function actionRemove()
 {
     if (!Yii::app()->getRequest()->getIsPostRequest() || !Yii::app()->getRequest()->getIsAjaxRequest()) {
         throw new CHttpException(404);
     }
     $productId = (int) Yii::app()->getRequest()->getPost('id');
     if (!$productId) {
         throw new CHttpException(404);
     }
     if ($this->favorite->remove($productId)) {
         Yii::app()->ajax->raw(['result' => true, 'data' => Yii::t('FavoriteModule.favorite', 'Success removed!'), 'count' => $this->favorite->count()]);
     }
     Yii::app()->ajax->raw(['message' => Yii::t('FavoriteModule.favorite', 'Error =('), 'result' => false, 'count' => $this->favorite->count()]);
 }