public function send($order, $order_id) { $this->load->model('setting/setting'); $settings = $this->model_setting_setting->getSetting('intarocrm'); $settings['domain'] = parse_url(HTTP_SERVER, PHP_URL_HOST); if (isset($settings['intarocrm_url']) && $settings['intarocrm_url'] != '' && isset($settings['intarocrm_apikey']) && $settings['intarocrm_apikey'] != '') { include_once DIR_SYSTEM . 'library/intarocrm/apihelper.php'; $order['order_id'] = $order_id; $crm = new ApiHelper($settings); $crm->processOrder($order); } }
/** * Get message ids * @return array */ private function getChatIds() { $chatIds = array(); $updates = $this->apiHelper->apiRequest('getUpdates', array('offset' => count($this->processedIds), 'limit' => 20, 'timeout' => 0)); if (is_array($updates)) { foreach ($updates as $update) { if (isset($update['message']['chat']['id'])) { $chatIds[$update['update_id']] = $update['message']['chat']['id']; } } } return $chatIds; }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/api.php'; $state = $this->get('State'); $canDo = ApiHelper::getActions($state->get('filter.category_id')); if (JVERSION >= '3.0') { JToolBarHelper::title(JText::_('COM_API_TITLE_LOGS'), 'list'); } else { JToolBarHelper::title(JText::_('COM_API_TITLE_LOGS'), 'logs.png'); } if ($canDo->get('core.edit.state')) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'logs.delete', 'JTOOLBAR_DELETE'); } // Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'logs.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('logs.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_api'); } if (JVERSION >= '3.0') { // Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_api&view=logs'); } $this->extra_sidebar = ''; }
/** * Retrieves all saved reports that meet args-driven criteria * * @param $api ServiceBase The API class of the request * @param $args array The arguments array passed in from the API * @return array */ public function getSavedReports($api, $args) { // Make sure the user isn't seeing reports they don't have access to require_once 'modules/Reports/SavedReport.php'; $modules = array_keys(getACLDisAllowedModules()); $fieldList = array('id', 'name', 'module', 'report_type', 'content', 'chart_type', 'assigned_user_id'); $sq = new SugarQuery(); $sq->from(BeanFactory::getBean('Reports')); $sq->select($fieldList); $sq->orderBy('name', 'asc'); // if there were restricted modules, add those to the query if (count($modules)) { $sq->where()->notIn('module', $modules); } if (isset($args['has_charts']) && $args['has_charts'] == 'true') { $sq->where()->notEquals('chart_type', 'none'); } if (isset($args['module']) && $args['module'] !== '') { $sq->where()->in('module', array($args['module'])); } $result = $sq->execute(); // check acls foreach ($result as $key => &$row) { $savedReport = $this->getSavedReportFromData($row); if ($savedReport->ACLAccess('list')) { // for front-end to check acls $row['_acl'] = ApiHelper::getHelper($api, $savedReport)->getBeanAcl($savedReport, $fieldList); } else { unset($result[$key]); } } return $result; }
protected function populateFromApi($api, $bean, $args, $options = array()) { $errors = ApiHelper::getHelper($api, $bean)->populateFromApi($bean, $args, $options); // remove email_addr_bean_rel records created by SugarFieldEmail::apiSave() for new bean (empty id) if (empty($args['id']) && !empty($bean->emailAddress)) { $bean->emailAddress->deleteLinks($bean->id, $bean->module_dir); } return $errors; }
public function institucion($categoria, $id = null) { $this->options['categoria'] = $categoria; $this->options['id'] = $id; Estructuras::setOptions($this->options); $encabezado = Estructuras::getEncabezado(); if ($encabezado) { $this->data = Estructuras::getEstructuraEncabezado($encabezado); } $response = ApiHelper::prepareResponse($this->data, 'institucion', $this->options, $this->total); Cache::add(Request::getRequestUri(), $response, Config::get('cache.time')); return $response; }
public function setRefund($order) { if (empty($order)) { throw new Exception("You already refunded for this class", 400); } $worldpay = new WorldpayHelper($this->worldpayKey); // Sometimes your SSL doesnt validate locally // DONT USE IN PRODUCTION $worldpay->disableSSLCheck(true); try { // Refund the order using the Worldpay order code $worldpay->refundOrder($order); } catch (Exception $e) { return ApiHelper::errorResponse($e->getMessage()); } }
public function get() { // Set the user doing the request as if they were authenticated in Joomla ApiHelper::setSessionUser(); if (!defined('K2_JVERSION')) { define('K2_JVERSION', '16'); } // Get the list of items $items = $this->getData(); if (!$items && $this->getError()) { $response = $this->getErrorResponse(400, $this->getError()); } else { $response = $items; } $this->plugin->setResponse($response); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/api.php'; $state = $this->get('State'); $canDo = ApiHelper::getActions($state->get('filter.category_id')); if (JVERSION >= '3.0') { JToolBarHelper::title(JText::_('COM_API_TITLE_KEYS'), 'key'); } else { JToolBarHelper::title(JText::_('COM_API_TITLE_KEYS'), 'keys.png'); } // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/key'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('key.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('key.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('keys.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('keys.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } } // Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'keys.delete', 'JTOOLBAR_DELETE'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_api'); } // Set sidebar action - New in 3.0 if (version_compare(JVERSION, '3.0.0', 'ge')) { JHtmlSidebar::setAction('index.php?option=com_api&view=keys'); $this->extra_sidebar = ''; } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; if ($isNew) { $viewTitle = JText::_('COM_API_ADD_KEY'); } else { $viewTitle = JText::_('COM_API_EDIT_KEY'); } if (JVERSION >= '3.0') { JToolBarHelper::title($viewTitle, 'pencil-2'); } else { JToolBarHelper::title($viewTitle, 'key.png'); } if (isset($this->item->checked_out)) { $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); } else { $checkedOut = false; } $canDo = ApiHelper::getActions(); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('key.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('key.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('key.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::custom('key.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('key.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('key.cancel', 'JTOOLBAR_CLOSE'); } }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:34 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $id = $name = $code = $count = $supplider = $phone = $max = $min = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["id"] == '') { echo json_encode(array("code" => "1", "msg" => "id is null")); return; } else { $id = input_helper($_POST["id"]); } if ($_POST["name"] == '') { echo json_encode(array("code" => "1", "msg" => "name is null")); return; } else { $name = input_helper($_POST["name"]); } if ($_POST["code"] == '') { echo json_encode(array("code" => "1", "msg" => "code is null")); return; } else { $code = input_helper($_POST["code"]);
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:28 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $id = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["id"] == '') { echo json_encode(array("code" => "1", "msg" => "id is null")); return; } else { $id = input_helper($_POST["id"]); } $apiHelper->productDelete($id); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:42 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $keyword = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $keyword = input_helper($_POST["keyword"]); $apiHelper->productQueryByKeyword($keyword); }
/** * Update records. * * @param $data array of job data */ public function runUpdate($data) { // Get the data down to just the list of fields $module = $data['module']; unset($data['module']); $action = $data['action']; unset($data['action']); $ids = is_array($data['uid']) ? $data['uid'] : array(); unset($data['uid']); unset($data['filter']); unset($data['entire']); $prospectLists = isset($data['prospect_lists']) ? $data['prospect_lists'] : array(); unset($data['prospect_lists']); $seed = BeanFactory::newBean($module); $fakeApi = new RestService(); $fakeApi->user = $GLOBALS['current_user']; $helper = ApiHelper::getHelper($fakeApi, $seed); $failed = 0; foreach ($ids as $id) { // Doing a full retrieve because we are writing we may need dependent fields for workflow that we don't know about $bean = BeanFactory::retrieveBean($module, $id); if ($bean == null) { // Team permissions may have changed, or a deletion, we won't hold it against them continue; } if (!$bean->aclAccess($action)) { // ACL's might not let them modify this bean, but we should still do the rest continue; } if ($action == 'delete') { $bean->mark_deleted($id); continue; } try { $errors = $helper->populateFromApi($bean, $data, array('massUpdate' => true)); $check_notify = $helper->checkNotify($bean); $bean->save($check_notify); } catch (SugarApiExceptionNotAuthorized $e) { // ACL's might not let them modify this bean, but we should still do the rest $failed++; continue; } } if (count($prospectLists) > 0) { $massupdate = new MassUpdate(); foreach ($prospectLists as $listId) { if ($action == 'save') { $success = $massupdate->add_prospects_to_prospect_list($module, $listId, $ids); } else { $success = $massupdate->remove_prospects_from_prospect_list($module, $listId, $ids); } } if (!$success) { $GLOBALS['log']->error("Could not add prospects to prospect list, could not find a relationship to the ProspectLists module."); } } return array('failed' => $failed); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:49 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $apiHelper->warehouseQueryAll(); }
/** * Fetches data from the $args array and updates the bean with that data * @param $bean SugarBean The bean to be updated * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array. * @param $args array The arguments array passed in from the API * @return id Bean id */ protected function updateBean(SugarBean $bean, ServiceBase $api, $args) { $helper = ApiHelper::getHelper($api, $bean); $options = array(); if (!empty($args['_headers']['X_TIMESTAMP'])) { $options['optimistic_lock'] = $args['_headers']['X_TIMESTAMP']; } try { $errors = $helper->populateFromApi($bean, $args, $options); } catch (SugarApiExceptionEditConflict $conflict) { $api->action = 'view'; $data = $this->formatBean($api, $args, $bean); // put current state of the record on the exception $conflict->setExtraData("record", $data); throw $conflict; } if ($errors !== true) { // There were validation errors. throw new SugarApiExceptionInvalidParameter('There were validation errors on the submitted data. Record was not saved.'); } $check_notify = $helper->checkNotify($bean); $bean->save($check_notify); /* * Refresh the bean with the latest data. * This is necessary due to BeanFactory caching. * Calling retrieve causes a cache refresh to occur. */ $id = $bean->id; if (isset($args['my_favorite'])) { $this->toggleFavorites($bean, $args['my_favorite']); } $bean->retrieve($id); /* * Even though the bean is refreshed above, return only the id * This allows loadBean to be run to handle formatting and ACL */ return $id; }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:43 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $id = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["id"] == '') { echo json_encode(array("code" => "1", "msg" => "id is null")); return; } else { $id = input_helper($_POST["id"]); } $apiHelper->warehouseQuery($id); }
/** * @param \Facebook\GraphNodes\GraphEdge $edge * @return array * @throws \Exception */ protected function saveRemoteData(Facebook\GraphNodes\GraphEdge $edge) { $arrPosts = ApiHelper::toPosts($edge); try { Post::model()->batchInsert($arrPosts, ['continueOnError' => true]); } catch (\Exception $e) { if ($e->getCode() !== 11000) { throw $e; } } $posts = []; foreach ($arrPosts as $item) { $post = new Post(); foreach ($item as $attr => $value) { $post->setAttribute($attr, $value); } $posts[] = $post; } return $posts; }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:43 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $id = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["id"] == '') { echo json_encode(array("code" => "1", "msg" => "id is null")); return; } else { $id = input_helper($_POST["id"]); } $apiHelper->productQueryById($id); }
public function actionPoliticasPrivacidad() { $politicas = ApiHelper::obtenerPoliticaPrivacidad(); $this->_sendResponse(200, CJSON::encode($politicas)); }
function updateRelatedLink($api, $args) { $api->action = 'save'; $primaryBean = $this->loadBean($api, $args); list($linkName, $relatedBean) = $this->checkRelatedSecurity($api, $args, $primaryBean, 'view', 'edit'); // Make sure the link isn't a readonly link if (isset($primaryBean->field_defs[$linkName])) { $def = $primaryBean->field_defs[$linkName]; if (isset($def['type']) && $def['type'] == 'link' && !empty($def['readonly'])) { throw new SugarApiExceptionNotAuthorized("Cannot update related records on readonly relationships"); } } $relatedBean->retrieve($args['remote_id']); if (empty($relatedBean->id)) { // Retrieve failed, probably doesn't have permissions throw new SugarApiExceptionNotFound('Could not find the related bean'); } BeanFactory::registerBean($relatedBean); // updateBean may remove the relationship. see PAT-337 for details $id = $this->updateBean($relatedBean, $api, $args); $relatedArray = array(); // Make sure there is a related object if (!empty($primaryBean->{$linkName})) { $relObj = $primaryBean->{$linkName}->getRelationshipObject(); } if (!empty($relObj)) { if ($primaryBean->module_name === $relObj->getLHSModule()) { $lhsBean = $primaryBean; $rhsBean = $relatedBean; } else { $lhsBean = $relatedBean; $rhsBean = $primaryBean; } // If the relationship still exists, we need to save changes to relationship fields if ($relObj->relationship_exists($lhsBean, $rhsBean)) { $relatedData = $this->getRelatedFields($api, $args, $primaryBean, $linkName, $relatedBean); // This function add() is actually 'addOrUpdate'. Here we use it for update only. $primaryBean->{$linkName}->add(array($relatedBean), $relatedData); // BR-2964, related objects are not populated ApiHelper::getHelper($api, $relatedBean)->populateFromApi($relatedBean, $args); // BR-2937 The edit view cache issue for relate documents of a module // nomad still needs this related array $relatedArray = $this->formatBean($api, $args, $relatedBean); } else { // Prepare the ralated bean data for formatNearAndFarRecords() below $relatedArray = $this->formatBean($api, $args, $relatedBean); // This record is unlinked to primary bean $relatedArray['_unlinked'] = true; } } //Clean up any hanging related records. SugarRelationship::resaveRelatedBeans(); // This forces a re-retrieval of the bean from the database BeanFactory::unregisterBean($relatedBean); return $this->formatNearAndFarRecords($api, $args, $primaryBean, $relatedArray); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:43 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $id = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["code"] == '') { echo json_encode(array("code" => "1", "msg" => "code is null")); return; } else { $code = input_helper($_POST["code"]); } $apiHelper->productQueryByCode($code); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/10/1 * Time: 上午1:46 */ require '../tool/ApiHelper.php'; $VERSION_CODE = "5"; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_POST["version"] !== $VERSION_CODE) { $info = '发现新版本 RTM 2 增加功能 1. 商品列表字体修改 2. 商品列表添加长按监听事件 3. 搜索功能添加二维码扫描并补全功能'; echo json_encode(array("code" => "0", "info" => $info, "url" => "http://112.126.64.86/wms/wms_rtm_2.apk")); } else { echo json_encode(array("code" => "2")); }
<?php require __DIR__ . "/classes/ApiHelper.php"; require __DIR__ . "/config/config.php"; if (!file_exists(__DIR__ . "/logs")) { mkdir(__DIR__ . "/logs"); } if (file_exists(__DIR__ . "/logs/cookie.txt")) { unlink(__DIR__ . "/logs/cookie.txt"); } $lockFile = __DIR__ . "/run.lock"; if (file_exists($lockFile)) { if ((int) file_get_contents($lockFile) > time()) { echo "script is busy"; exit; } } file_put_contents("run.lock", strtotime('+5 minutes')); if (file_exists(__DIR__ . "/logs/sync.log")) { $config['date_from'] = file_get_contents(__DIR__ . "/logs/sync.log"); } $apiHelper = new ApiHelper($сonfig); if ($apiHelper->processXMLOrders()) { unlink($lockFile); file_put_contents(__DIR__ . "/logs/sync.log", date('Y-m-d H:i:s')); }
/** * Request method * * @param string $httpMethod * @param string $path * @param array $params * @param string $version * @param bool $isAuthorization * * @return Response * @throws ClientException * @throws AuthorizeException * @throws ServerException * @throws Error */ public function request($httpMethod = 'GET', $path = '', $params = array(), $version = '', $isAuthorization = false) { if ($httpMethod != 'GET') { $post_params = array(); if (!$isAuthorization) { $post_params['access_token'] = $this->accessToken; $api_callback = ApiHelper::getBetween($path, 'admin/', '.json'); $parser = explode('/', $api_callback); $api_callback = substr($parser[0], 0, -1); //get singular string by remove last s //TODO: get proper singular string for '-es' case. if (!empty($params)) { $post_params[$api_callback] = $params; } } else { $post_params['staff'] = $params; } $params = $post_params; } else { //add access_token to GET api $params['access_token'] = $this->accessToken; } return $this->strategy->request($httpMethod, $this->apiUrl . $path, $params, $version, $isAuthorization); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:55 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $orderid = $name = $code = $count = $price = $charge = ""; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["orderid"] == '') { echo json_encode(array("code" => "1", "msg" => "orderid is null")); return; } else { $orderid = input_helper($_POST["orderid"]); } if ($_POST["name"] == '') { echo json_encode(array("code" => "1", "msg" => "name is null")); return; } else { $name = input_helper($_POST["name"]); } if ($_POST["code"] == '') { echo json_encode(array("code" => "1", "msg" => "code is null")); return; } else { $code = input_helper($_POST["code"]);
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:53 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $apiHelper->deliveryQueryAll(); }
<?php /** * Created by PhpStorm. * User: zhangchaojie * Date: 15/9/18 * Time: 上午10:42 */ require '../tool/ApiHelper.php'; require '../tool/InputHelper.php'; $apiHelper = new ApiHelper(); $apiHelper->log(__FILE__, $_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $apiHelper->productQueryAll(); }
public function cancelClass() { $trans = $this->hasOne(TransactionHistory::className(), ['class_id' => 'class_id'])->where(['class_id' => $this->class_id])->andWhere("`transation_id` NOT IN (SELECT `transation_id` FROM `transaction_history` WHERE `class_id` = {$this->class_id} AND `status` = 'REFUNDED')")->all(); if ($trans) { $transModel = new TransactionHistory(); foreach ($trans as $val) { $transModel->setRefund($val->transation_id); $transactionData = array("user_id" => $val->user_id, "description" => "Trainer refunded class {$this->class_name}", "transation_id" => $val->transation_id, "status" => 'REFUNDED', "amount" => $val->amount * -1, "currency" => 'USD', "class_id" => $this->class_id, "transaction_refund" => true); $transactionHistoty = new TransactionHistory(); $transactionHistoty->load($transactionData, ''); if (!$transactionHistoty->save()) { return ApiHelper::errorResponse($transactionHistoty->getErrors(), 422); } $notification = new Notification(); $notification->load(array("user_id" => $val->user_id, "title" => "Refunded class {$this->class_name}", "text" => "Trainer remove class '{$this->class_name}'", "status" => "new"), ''); $notification->save(); $notificationTrainer = new Notification(); $notificationTrainer->load(array("user_id" => $this->class_trainer_id, "title" => "You successfuly remove class.", "text" => "You successfuly remove class '{$this->class_name}'.", "status" => "new"), ''); $notificationTrainer->save(); } } $query = self::findOne(['class_id' => $this->class_id]); $query->delete(); }