Example #1
0
 protected function beforeStore(&$response, &$params, &$store)
 {
     //handle deletes for searching differently
     if (!empty($params['delete_keys'])) {
         try {
             $keys = json_decode($params['delete_keys'], true);
             unset($params['delete_keys']);
             foreach ($keys as $key) {
                 $key = explode(':', $key);
                 $linkedModel = \GO::getModel($key[0])->findByPk($key[1]);
                 if ($linkedModel) {
                     $linkedModel->delete();
                 }
             }
             unset($params['delete_keys']);
             $response['deleteSuccess'] = true;
         } catch (\Exception $e) {
             $response['deleteSuccess'] = false;
             $response['deleteFeedback'] = $e->getMessage();
         }
     }
     //search query is required
     if (empty($params["query"])) {
         return false;
     } else {
         //we'll do a full text search in getStoreParams
         //			$params['match']=$params["query"];
         //			unset($params["query"]);
     }
     return parent::beforeStore($response, $params, $store);
 }
Example #2
0
 protected function beforeStore(&$response, &$params, &$store)
 {
     $store->setDefaultSortOrder('name');
     return parent::beforeStore($response, $params, $store);
 }
Example #3
0
 protected function beforeStore(&$response, &$params, &$store)
 {
     if (isset($params['completed_task_id'])) {
         $updateTask = \GO\Tasks\Model\Task::model()->findByPk($params['completed_task_id']);
         if (isset($params['checked'])) {
             $updateTask->setCompleted($params['checked'] == "true");
         }
     }
     //
     return parent::beforeStore($response, $params, $store);
 }