0

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.

AD7six
  • 63,116
  • 12
  • 91
  • 123
Indzi
  • 390
  • 5
  • 24
  • There are a lot of "if"s in this method. Do you use e.g. Xdebug to step through it? This might be helpful. – alexdd55 May 31 '14 at 08:03

1 Answers1

2

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

Community
  • 1
  • 1
MrLore
  • 3,759
  • 2
  • 28
  • 36
  • +1 just for the effort of translating the error message. It's not apparent what code writes "message", which code populates the value or _if_ save is called - but the above is all good crystal-ball work. – AD7six May 31 '14 at 19:10
  • yes the problem was in field input. I will edit the final answer – Indzi Jun 01 '14 at 05:09