Yii Framework Forum: Yii-Bootstrap-Editable, Editablecolumn With Compositeprimarykey - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Bootstrap-Editable, Editablecolumn With Compositeprimarykey Rate Topic: -----

#1 User is offline   nath-0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 12-October 12
  • Location:switzerland

Posted 22 January 2013 - 05:08 AM

Hello,

I am using yii-bootstrap-editable with EditableColumn.
My model has a composite key :

Quote

Array
(
[rapport_activite_id] => 49175
[fk_tache] => 922
[fk_projet] => 825
[fk_personne] => 156
)


And I had a error at the function (in the file EditableField.php):

 public function getSelector()
    {
       
  return get_class($this->model) . '_' . $this->attribute . ($this->model->PrimaryKey ? '_' . $this->model->PrimaryKey : '_new'); 
       
    }


so I modify the code :
 public function getSelector()
    {
       
        if(is_array($this->model->PrimaryKey)){
            return get_class($this->model) . '_' . $this->attribute . ($this->model->PrimaryKeyFirst ? '_' . $this->model->PrimaryKeyFirst : '_new');
        }else{
           return get_class($this->model) . '_' . $this->attribute . ($this->model->PrimaryKey ? '_' . $this->model->PrimaryKey : '_new'); 
        }
    }

and overwrite activeRecord and add propretie PrimaryKeyFirst

But now, I get a other error, because of my composite primary key:

in the file EditableField.php
 public function renderLink()
    {
       
        echo CHtml::openTag('a', $this->htmlOptions);
        $this->renderText();
        echo CHtml::closeTag('a');
    }


value of $this->htmlOptions :

Quote

Array
(
[href] => #
[rel] => TRapportsActivites_heures
[data-pk] => Array
(
[rapport_activite_id] => 49175
[fk_tache] => 922
[fk_projet] => 825
[fk_personne] => 156
)

)


Maybe it is a bug of Editablecolumn?
My solution for the first problem that I had is not very good.

Nath
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users