doushanlv5184 2014-05-31 06:05
浏览 47
已采纳

CakePHP:无法找出错误“成功”:false,“message”:

I tried a great deal of research in this site for these kind of errors but couldnt figure out my problem so posting it here.

first the error message:-

{"success":false,"message":"\u0630\u062e\u06cc\u0631\u0647 \u062f\u0686\u0627\u0631 \u062e\u0637\u0627 \u0634\u062f . \u0644\u0637\u0641\u0627 \u062f\u0648\u0628\u0627\u0631\u0647 \u0633\u0639\u06cc \u06a9\u0646\u06cc\u062f"}

The method that is calling the view is

Method

public function checklist(){
        if($this->request->is('ajax')){
            parent::edit();
        }
        $this->set('tree',$this->Task->Attribute->getTree(array('Attribute.mode' => 'checkable')));
    }

The method involved in this action

Method

protected function _extraSave($task_id){
        $success = false;
        if('Check' == ifExist($this->Task->getFieldValue($task_id ,'type'))){
            if(ifExist($this->request->data ,'TaskAttribute')){
                $taskAttributeModel = $this->_getModel('TaskAttribute');
                foreach($this->request->data['TaskAttribute'] as $attribute){
                    if(0 !=  $attribute['attribute_id']){
                        $taskAttributeModel->id = false;
                        if(!$success = $taskAttributeModel->save(array($taskAttributeModel->alias=>array('task_id'=>$task_id ,'attribute_id'=> $attr['attribute_id'] ,'value'=>$attribute['value'])))){
                            break;
                        }
                     }
                }
            }
        }
return $success ; 
}

The method i am using to fetch the data is

Method

public function getTree($branch_id =false){
        $data = array();
        $result =  $this->find('all',array(
            'fields' => array('Attribute.name', 'Attribute.id','Attribute.type','AttributeOptions.id','AttributeOptions.label', 'Item.category_id', 'Item.id','Item.model','Item.service','Category.id','Category.name'),
            'joins' =>  array(

                        array(
                            'table' => 'attributes',
                            'alias' => 'Attribute',
                            'type' => 'INNER',
                            'conditions' => 'TaskAttribute.attribute_id = Attribute.id',
                         ),
                         array( 
                            'table' => 'item_attributes',
                            'alias' => 'ItemAttribute',
                            'type' => 'INNER',
                            'conditions' => 'ItemAttribute.attribute_id = Attribute.id'
                        ),                              
                         array( 
                            'table' => 'items',
                            'alias' => 'Item',
                            'type' => 'INNER',
                            'conditions' => 'ItemAttribute.item_id = Item.id'
                        ),
                         array( 
                            'table' => 'taxonomies',
                            'alias' => 'Category',
                                'type' => 'LEFT',
                            'conditions' => 'Item.category_id = Category.id'
                            ),
                        array( 
                            'table' => 'attribute_options',
                            'alias' => 'AttributeOptions',
                            'type' => 'LEFT',
                            'conditions' => 'Attribute.id = AttributeOptions.attribute_id'
                            ) 

                ),
                'recursive'=>-1
            )
        );

Expecting a expert solution for it.. to be noted I am new to Cake.

  • 写回答

1条回答 默认 最新

  • downing1988 2014-05-31 06:30
    关注

    Okay, so the error message is in encoded Unicode:

    \u0630\u062e\u06cc\u0631\u0647 \u062f\u0686\u0627\u0631 \u062e\u0637\u0627 \u0634\u062f . \u0644\u0637\u0641\u0627 \u062f\u0648\u0628\u0627\u0631\u0647 \u0633\u0639\u06cc \u06a9\u0646\u06cc\u062f

    Which apparently represents this Arabic phrase:

    ذخیره دچار خطا شد . لطفا دوباره سعی کنید

    And Google Translate says this means

    Powered [or 'Storage'] error. Please try again

    This combined with the fact you're doing saving makes me think something isn't right with your data or fields, and as such I'd recommend trying to debug as detailed in this question, by examining this method and field:

    $taskAttributeModel->invalidFields()

    $taskAttributeModel->validationErrors

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看