• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Model的典型用法代码示例。如果您正苦于以下问题:PHP Model类的具体用法?PHP Model怎么用?PHP Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: transform

 /**
  * Transforms an object (model) to an integer (int).
  *
  * @param  \Model|null $model
  * @return int
  */
 public function transform($model)
 {
     if (empty($model)) {
         return 0;
     }
     return $model->getID();
 }
开发者ID:allejo,项目名称:bzion,代码行数:13,代码来源:SingleModelTransformer.php


示例2: beforeSave

 /**
  * beforeSave is called before a model is saved. Returning false from a beforeSave callback
  * will abort the save operation.
  *
  * @param Model $model Model using this behavior
  * @param array $options Options passed from Model::save().
  * @return mixed False if the operation should abort. Any other result will continue.
  * @see Model::save()
  */
 public function beforeSave(Model $model, $options = array())
 {
     if (!empty($model->hasMany['Audit'])) {
         if ($model->id = !empty($model->id) ? $model->id : (!empty($model->data[$model->alias]['id']) ? $model->data[$model->alias]['id'] : '')) {
             $this->data[$model->id]['Audit']['entity'] = (!empty($model->plugin) ? $model->plugin . '.' : '') . $model->name;
             $this->data[$model->id]['Audit']['entity_id'] = $model->id;
             $this->data[$model->id]['Audit']['event'] = $model->exists() ? 'UPDATE' : 'CREATE';
             $this->data[$model->id]['Audit']['new'] = $this->data[$model->id]['Audit']['old'] = array();
             $this->data[$model->id]['Audit']['creator_id'] = !empty($model->data['Creator']['id']) ? $model->data['Creator']['id'] : null;
             $model->data = Hash::remove($model->data, 'Creator');
             if ($this->data[$model->id]['Audit']['event'] == 'CREATE') {
                 $this->data[$model->id]['Audit']['old'] = json_encode(array());
                 $this->data[$model->id]['Audit']['new'] = json_encode($model->data[$model->alias]);
             } else {
                 if ($this->data[$model->id]['Audit']['event'] == 'UPDATE') {
                     $old = $model->find('first', array('conditions' => array($model->alias . '.id' => $model->id), 'recursive' => -1));
                     foreach ($model->data[$model->alias] as $field => $value) {
                         if ($field == 'updated') {
                             continue;
                         }
                         if ($model->hasField($field) && $old[$model->alias][$field] != $value) {
                             $this->data[$model->id]['Audit']['old'][$field] = $old[$model->alias][$field];
                             $this->data[$model->id]['Audit']['new'][$field] = $value;
                         }
                     }
                     if (!empty($this->data[$model->id]['Audit']['old']) && !empty($this->data[$model->id]['Audit']['new'])) {
                         $this->data[$model->id]['Audit']['old'] = json_encode($this->data[$model->id]['Audit']['old']);
                         $this->data[$model->id]['Audit']['new'] = json_encode($this->data[$model->id]['Audit']['new']);
                     }
                 }
             }
         }
     }
     return parent::beforeSave($model, $options);
 }
开发者ID:jsemander,项目名称:cakephp-utilities,代码行数:44,代码来源:AuditableBehavior.php


示例3: remover

 public static function remover(Model $uf)
 {
     if ($uf->get("id")) {
         $sql = "delete from uf where id = :id";
     }
     return self::exec($sql, $uf);
 }
开发者ID:cokita,项目名称:srp,代码行数:7,代码来源:UfDAO.php


示例4: create_topic

function create_topic($request)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die('', 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        $model = new Model();
        if (!isset($input_data['name'])) {
            $input_data['name'] = '';
        }
        $topic_id = $model->create_topic($input_data['name']);
        if ($topic_id) {
            http_response_code(201);
            header('Content-Type: text/plain');
            echo '/topics/' . $topic_id;
            die;
        } else {
            Util::output_errors_and_die('', 400);
        }
    } catch (ConflictException $e) {
        Util::output_errors_and_die($e->getMessage(), 409);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:35,代码来源:create_topic.php


示例5: setup

 /**
  * Adjust configs like: $Model->Behaviors-attach('Tools.DecimalInput', array('fields'=>array('xyz')))
  * leave fields empty to auto-detect all float inputs
  *
  * @return void
  */
 public function setup(Model $Model, $config = array())
 {
     $this->settings[$Model->alias] = $this->_defaultConfig;
     if (!empty($config['strict'])) {
         $this->settings[$Model->alias]['transform']['.'] = '#';
     }
     if ($this->settings[$Model->alias]['localeconv'] || !empty($config['localeconv'])) {
         // use locale settings
         $conv = localeconv();
         $loc = array('decimals' => $conv['decimal_point'], 'thousands' => $conv['thousands_sep']);
     } elseif ($configure = Configure::read('Localization')) {
         // Use configure settings
         $loc = (array) $configure;
     }
     if (!empty($loc)) {
         $this->settings[$Model->alias]['transform'] = array($loc['thousands'] => $this->settings[$Model->alias]['transform']['.'], $loc['decimals'] => $this->settings[$Model->alias]['transform'][',']);
     }
     $this->settings[$Model->alias] = $config + $this->settings[$Model->alias];
     $numberFields = array();
     $schema = $Model->schema();
     foreach ($schema as $key => $values) {
         if (isset($values['type']) && !in_array($key, $this->settings[$Model->alias]['fields']) && in_array($values['type'], $this->settings[$Model->alias]['observedTypes'])) {
             array_push($numberFields, $key);
         }
     }
     $this->settings[$Model->alias]['fields'] = array_merge($this->settings[$Model->alias]['fields'], $numberFields);
 }
开发者ID:Jony01,项目名称:LLD,代码行数:33,代码来源:DecimalInputBehavior.php


示例6: bindTagAssociations

 /**
  * Bind tag assocations
  *
  * @param Model $model Model instance that behavior is attached to
  * @return void
  */
 public function bindTagAssociations(Model $model)
 {
     extract($this->settings[$model->alias]);
     list($plugin, $withClass) = pluginSplit($withModel, true);
     $model->bindModel(array('hasAndBelongsToMany' => array($tagAlias => array('className' => $tagClass, 'foreignKey' => $foreignKey, 'associationForeignKey' => $associationForeignKey, 'unique' => true, 'conditions' => array($withClass . '.model' => $model->name), 'fields' => '', 'dependent' => true, 'with' => $withModel))), $resetBinding);
     $model->{$tagAlias}->bindModel(array('hasMany' => array($taggedAlias => array('className' => $taggedClass))), $resetBinding);
 }
开发者ID:tnoi,项目名称:tags,代码行数:13,代码来源:TaggableBehavior.php


示例7: _parseJoins

 /**
  * Recursively parses joins
  *
  * @param Model $Model
  * @param array $joins
  * @return array
  */
 protected function _parseJoins(Model $Model, $joins, $defaults = array())
 {
     $ds = $Model->getDataSource();
     $defaults = array_merge($this->_defaults, $defaults);
     if (isset($joins['defaults'])) {
         $defaults = array_merge($defaults, $joins['defaults']);
         unset($joins['defaults']);
     }
     foreach ((array) $joins as $association => $options) {
         if (is_string($options)) {
             if (is_numeric($association)) {
                 $association = $options;
                 $options = array();
             } else {
                 $options = (array) $options;
             }
         }
         $AssociatedModel = $this->_associatedModel($Model, $association);
         $deeperAssociations = array_diff_key($options, $defaults);
         $options = array_merge($defaults, $options);
         $this->_join($Model, $association, $options['conditions'], $options['type']);
         $fields = false;
         if ($options['fields'] === true) {
             $fields = null;
         } elseif (!empty($options['fields'])) {
             $fields = $options['fields'];
         }
         if ($fields !== false) {
             $this->_query['fields'] = array_merge($this->_query['fields'], $ds->fields($AssociatedModel, null, $fields));
         }
         if (!empty($deeperAssociations)) {
             $this->_parseJoins($AssociatedModel, $deeperAssociations, $defaults);
         }
     }
 }
开发者ID:ollietreend,项目名称:cakephp-joinable,代码行数:42,代码来源:JoinableBehavior.php


示例8: getMsgList

function getMsgList($parm = array())
{
    $M = new Model('member_msg');
    $pre = C('DB_PREFIX');
    $field = true;
    $orderby = " id DESC";
    if ($parm['pagesize']) {
        //分页处理
        import("ORG.Util.Page");
        $count = $M->where($parm['map'])->count('id');
        $p = new \Org\Util\Page($count, $parm['pagesize']);
        $page = $p->show();
        $Lsql = "{$p->firstRow},{$p->listRows}";
        //分页处理
    } else {
        $page = "";
        $Lsql = "{$parm['limit']}";
    }
    $data = M('member_msg')->field(true)->where($parm['map'])->order($orderby)->limit($Lsql)->select();
    $symbol = C('MONEY_SYMBOL');
    $suffix = C("URL_HTML_SUFFIX");
    foreach ($data as $key => $v) {
    }
    $row = array();
    $row['list'] = $data;
    $row['page'] = $page;
    $row['count'] = $count;
    return $row;
}
开发者ID:kinglong366,项目名称:p2p,代码行数:29,代码来源:function.php


示例9: addToBasket

 public function addToBasket(Model $Model, $id, array $options = array())
 {
     $options = Hash::merge(array('basket' => $Model->ShoppingBasketItem->ShoppingBasket->currentBasketId(), 'amount' => 1, 'configuration' => array(), 'non_overridable' => array()), array_filter($options));
     $configurationGroupIds = $Model->ItemConfigurationGroup->find('list', array('fields' => array('ConfigurationGroup.id'), 'conditions' => array('ItemConfigurationGroup.foreign_key' => $id, 'ItemConfigurationGroup.model' => $Model->name), 'contain' => array('ConfigurationGroup')));
     $valueData = $Model->ShoppingBasketItem->ConfigurationValue->generateValueData($Model->ShoppingBasketItem->name, $configurationGroupIds, $options['configuration'], $options['non_overridable']);
     $stackable = $Model->field('stackable', array('id' => $id));
     if ($stackable) {
         $shoppingBasketItemId = $Model->ShoppingBasketItem->field('id', array('ShoppingBasketItem.shopping_basket_id' => $options['basket'], 'ShoppingBasketItem.product_id' => $id));
         if (!$shoppingBasketItemId) {
             $Model->ShoppingBasketItem->create();
             $data = $Model->ShoppingBasketItem->saveAssociated(array('ShoppingBasketItem' => array('shopping_basket_id' => $options['basket'], 'product_id' => $id, 'amount' => $options['amount']), 'ConfigurationValue' => $valueData));
             return $data;
         }
         $Model->ShoppingBasketItem->id = $shoppingBasketItemId;
         $amount = $Model->ShoppingBasketItem->field('amount');
         return $Model->ShoppingBasketItem->saveField('amount', $amount + $options['amount']);
     }
     for ($number = 1; $number <= $options['amount']; $number++) {
         $Model->ShoppingBasketItem->create();
         $data = $Model->ShoppingBasketItem->saveAssociated(array('ShoppingBasketItem' => array('shopping_basket_id' => $options['basket'], 'product_id' => $id, 'amount' => 1), 'ConfigurationValue' => $valueData));
         if (!$data) {
             return false;
         }
     }
     return true;
 }
开发者ID:cvo-technologies,项目名称:croogo-webshop-shopping-cart-plugin,代码行数:26,代码来源:CartItemBehavior.php


示例10: beforeValidate

 /**
  * beforeValidate is called before a model is validated, you can use this callback to
  * add behavior validation rules into a models validate array. Returning false
  * will allow you to make the validation fail.
  *
  * @param Model $model Model using this behavior
  * @param array $options Options passed from Model::save().
  * @return mixed False or null will abort the operation. Any other result will continue.
  * @see Model::save()
  */
 public function beforeValidate(Model $model, $options = array())
 {
     $model->loadModels(array('CircularNoticeContent' => 'CircularNotices.CircularNoticeContent', 'CircularNoticeTargetUser' => 'CircularNotices.CircularNoticeTargetUser', 'User' => 'Users.User'));
     if (!$model->data['CircularNoticeContent']['is_room_target']) {
         // 回覧先ユーザのバリデーション処理
         if (!isset($model->data['CircularNoticeTargetUser'])) {
             $model->data['CircularNoticeTargetUser'] = array();
         }
         $model->CircularNoticeTargetUser->set($model->data['CircularNoticeTargetUser']);
         // ユーザ選択チェック
         $targetUsers = Hash::extract($model->data['CircularNoticeTargetUser'], '{n}.user_id');
         if (!$model->CircularNoticeTargetUser->isUserSelected($targetUsers)) {
             $model->CircularNoticeTargetUser->validationErrors['user_id'] = sprintf(__d('circular_notices', 'Select user'));
             $model->validationErrors = Hash::merge($model->validationErrors, $model->CircularNoticeTargetUser->validationErrors);
             return false;
         }
         if (!$model->CircularNoticeTargetUser->validates()) {
             $model->validationErrors = Hash::merge($model->validationErrors, $model->CircularNoticeTargetUser->validationErrors);
             return false;
         }
         if (!$model->User->existsUser($targetUsers)) {
             $model->CircularNoticeTargetUser->validationErrors['user_id'][] = sprintf(__d('net_commons', 'Failed on validation errors. Please check the input data.'));
             $model->validationErrors = Hash::merge($model->validationErrors, $model->CircularNoticeTargetUser->validationErrors);
             return false;
         }
     }
     return true;
 }
开发者ID:go-to,项目名称:CircularNotices,代码行数:38,代码来源:CircularNoticeTargetUserBehavior.php


示例11: import

 function import($sFile)
 {
     if (!$this->bSpycReady) {
         return self::SPYC_CLASS_NOT_FOUND;
     }
     if (!file_exists($sFile)) {
         return self::YAML_FILE_NOT_FOUND;
     }
     $this->aTables = SPYC::YAMLload(file_get_contents($sFile));
     if (!is_array($this->aTables)) {
         return self::YAML_FILE_IS_INVALID;
     }
     uses('model' . DS . 'model');
     $oDB = $this->oDb;
     $aAllowedTables = $oDB->listSources();
     foreach ($this->aTables as $table => $records) {
         if (!in_array($oDB->config['prefix'] . $table, $aAllowedTables)) {
             return self::TABLE_NOT_FOUND;
         }
         $temp_model = new Model(false, $table);
         foreach ($records as $record_num => $record_value) {
             if (!isset($record_value['id'])) {
                 $record_value['id'] = $record_num;
             }
             if (!$temp_model->save($record_value)) {
                 return array('error' => array('table' => $table, 'record' => $record_value));
             }
         }
     }
     return true;
 }
开发者ID:gildonei,项目名称:candycane,代码行数:31,代码来源:fixtures.php


示例12: get_user_price_list

 public function get_user_price_list($user_id)
 {
     $model = new Model();
     $condition['user_id'] = $user_id;
     $list = $model->table('ldh_price_user')->field('ldh_price.code,ldh_price.password,ldh_price_user.price_id')->join('ldh_price ON ldh_price_user.price_id = ldh_price.price_id')->where($condition)->select();
     return $list;
 }
开发者ID:macall,项目名称:ldh,代码行数:7,代码来源:PriceUserModel.class.php


示例13: __construct

 public function __construct($util, $get = null)
 {
     parent::__construct($util);
     $this->model();
     $this->setViewMenu();
     if (isset($get["vers"])) {
         $vers = $get["vers"];
     } else {
         $vers = 1;
     }
     if (isset($get["depuis"])) {
         $depuis = $get["depuis"];
     } else {
         $depuis = 1;
     }
     $model = new Model();
     if (isset($get["enregistrer"])) {
         //on a cliqué un bouton enregistrer
         if (isset($get["li"])) {
             //il y a des situs (inutile ici...)
             $model->validSitu($get["chk"], $this->util->getId(), $get["li"]);
         }
     }
     $data["lessitus"] = $model->getSitus($util->getId(), $util->getNumGroupe(), $vers);
     $data["auth"] = $this->util->estAuthent();
     $data["vers"] = $vers;
     $data["type"] = "V";
     //validations
     $this->view->init('dessitus.php', $data);
     $this->setViewBas();
     $model->close();
 }
开发者ID:PierreBeillon,项目名称:SuiviSIO,代码行数:32,代码来源:Valid.class.php


示例14: __construct

 function __construct()
 {
     $model = new Model();
     $this->connection = $model->get_connection();
     //$this->connection = new mysqli('sql4.freemysqlhosting.net', 'sql497000', 'bGNjUbh2SS', 'sql497000');
     $this->check();
 }
开发者ID:ValeriyMezeria,项目名称:sportdiary,代码行数:7,代码来源:authentification.php


示例15: many_to_many

 public function many_to_many(Model $reference)
 {
     $columns1 = parent::findConstraitn('PrimaryKey')->getColumns();
     $columns2 = $reference->findConstraitn('PrimaryKey')->getColumns();
     $mtm = ManyToMany::getInstance(parent::persistence(), $reference->persistence(), $columns1, $columns2);
     $this->weaks_entitys[get_class($mtm)] = $mtm;
 }
开发者ID:exildev,项目名称:corvus,代码行数:7,代码来源:Model.php


示例16: update_programming_language

function update_programming_language($pl_id, $request)
{
    Authenticator::assert_manager($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die('', 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        $result = $model->edit_programming_language($pl_id, $input_data);
        header('Content-Type: text/plain');
        http_response_code($result ? 200 : 404);
        die;
    } catch (ConflictException $e) {
        Util::output_errors_and_die($e->getMessage(), 409);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:27,代码来源:update_programming_language.php


示例17: before_insert

 /**
  * Creates a unique slug and adds it to the object
  *
  * @param  Model  Model object subject of this observer method
  */
 public function before_insert(Model $obj)
 {
     // determine the slug
     $properties = (array) $this->_source;
     $source = '';
     foreach ($properties as $property) {
         $source .= '-' . $obj->{$property};
     }
     $slug = \Inflector::friendly_title(substr($source, 1), '-', true);
     // query to check for existence of this slug
     $query = $obj->query()->where($this->_property, 'like', $slug . '%');
     // is this a temporal model?
     if ($obj instanceof Model_Temporal) {
         // add a filter to only check current revisions excluding the current object
         $class = get_class($obj);
         $query->where($class::temporal_property('end_column'), '=', $class::temporal_property('max_timestamp'));
         foreach ($class::getNonTimestampPks() as $key) {
             $query->where($key, '!=', $obj->{$key});
         }
     }
     // do we have records with this slug?
     $same = $query->get();
     // make sure our slug is unique
     if (!empty($same)) {
         $max = -1;
         foreach ($same as $record) {
             if (preg_match('/^' . $slug . '(?:-([0-9]+))?$/', $record->{$this->_property}, $matches)) {
                 $index = isset($matches[1]) ? (int) $matches[1] : 0;
                 $max < $index and $max = $index;
             }
         }
         $max < 0 or $slug .= '-' . ($max + 1);
     }
     $obj->{$this->_property} = $slug;
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:40,代码来源:slug.php


示例18: beforeSave

 public function beforeSave(Model $model, $options = array())
 {
     $columns = $model->getColumnTypes();
     foreach ($model->data as $modelClass => $values) {
         foreach ($values as $field => $value) {
             if (!isset($columns[$field]) or $columns[$field] != 'binary') {
                 continue;
             }
             if (is_array($value) and isset($value['size'])) {
                 if ($value["size"] > 0) {
                     $fileHandler = new BlobFileHandler();
                     $fileHandler->loadFromFile($value['tmp_name']);
                     if ($fileHandler->getImageWith() > $this->config['imageMaxWidth']) {
                         $fileHandler->modify('resize', $this->config['imageMaxWidth']);
                         // max image size
                         $fileData = $fileHandler->store(null, $fileHandler->resourceInfo[2], 90);
                     } else {
                         $fileData = file_get_contents($value['tmp_name']);
                     }
                     $model->data[$modelClass][$field] = $fileData;
                 } else {
                     unset($model->data[$modelClass][$field]);
                 }
             }
         }
     }
     return true;
 }
开发者ID:elic-dev,项目名称:database-blob-file,代码行数:28,代码来源:BlobFileBehavior.php


示例19: beforeValidate

 /**
  * {@inheritdoc}
  */
 public function beforeValidate(Model $Model, $options = array())
 {
     $ModelValidator = $Model->validator();
     foreach ($Model->data[$Model->alias] as $field => $value) {
         if (!preg_match('/^([a-z0-9_]+)_confirm$/i', $field, $match)) {
             continue;
         }
         if (!array_key_exists($match[1], $Model->data[$Model->alias])) {
             continue;
         }
         if (!($Ruleset = $ModelValidator->getField($match[1]))) {
             $Ruleset = new CakeValidationSet($match[1], array());
         }
         $ruleset = array();
         foreach ($Ruleset->getRules() as $name => $Rule) {
             $ruleset[$name] = (array) $Rule;
             foreach (array_keys($ruleset[$name]) as $key) {
                 if (!preg_match('/^[a-z]/i', $key)) {
                     unset($ruleset[$name][$key]);
                 }
             }
         }
         $ModelValidator->add($field, new CakeValidationSet($field, array()));
         $ModelValidator->getField($field)->setRule('confirmed', array('rule' => 'isConfirmed', 'message' => __d('common', "No match.")));
     }
     return true;
 }
开发者ID:gourmet,项目名称:common,代码行数:30,代码来源:ConfirmableBehavior.php


示例20: afterSave

 /**
  * afterSave is called after a model is saved.
  *
  * @param Model $model Model using this behavior
  * @param bool $created True if this save created a new record
  * @param array $options Options passed from Model::save().
  * @return bool
  * @throws InternalErrorException
  * @see Model::save()
  */
 public function afterSave(Model $model, $created, $options = array())
 {
     if (!isset($model->data['Categories'])) {
         return true;
     }
     $model->loadModels(array('Category' => 'Categories.Category', 'CategoryOrder' => 'Categories.CategoryOrder'));
     $categoryKeys = Hash::combine($model->data['Categories'], '{n}.Category.key', '{n}.Category.key');
     //削除処理
     $conditions = array('block_id' => $model->data['Block']['id']);
     if ($categoryKeys) {
         $conditions[$model->Category->alias . '.key NOT'] = $categoryKeys;
     }
     if (!$model->Category->deleteAll($conditions, false)) {
         throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
     }
     $conditions = array('block_key' => $model->data['Block']['key']);
     if ($categoryKeys) {
         $conditions[$model->CategoryOrder->alias . '.category_key NOT'] = $categoryKeys;
     }
     if (!$model->CategoryOrder->deleteAll($conditions, false)) {
         throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
     }
     //登録処理
     foreach ($model->data['Categories'] as $category) {
         if (!($result = $model->Category->save($category['Category'], false))) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         $category['CategoryOrder']['category_key'] = $result['Category']['key'];
         if (!$model->CategoryOrder->save($category['CategoryOrder'], false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
     }
     return parent::afterSave($model, $created, $options);
 }
开发者ID:Onasusweb,项目名称:Categories,代码行数:44,代码来源:CategoryBehavior.php



注:本文中的Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ModelAdmin类代码示例发布时间:2022-05-23
下一篇:
PHP ModalView类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap