[eluser]Unknown[/eluser]
It is related to datamapper ORM
Rights: var $has_many = array("roles"); - it has rights entered in table
Role: var $has_many = array("rights"); - it has rights entered in table
Relation will be roles_rights
What I am doing is I am setting perimssion for one of my role say manager
Code:
Controller
insertAction Radiobutton1 Radiobutton2
deleteAction Radiobutton1 Radiobutton2
When I click on save button it should save in relation table, roles_rights. But is is not happening. Can anyone figure out what the problem is?
I am not able to save the data.
Actual code
Code:
$role = new Role();
$role->where('id',(int)$this->input->post('id'))->get();
$exists = $role->exists();
if($exists){
$right = new Right();
$right->role_id = 18;
$right->right_id = 1;
$right->permission = 1;
$isSaved = $role->save($right);
echo "Saved";
}else{
echo "No Saved";
}
Thanks