Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorhpatoio
    • CommentTimeMay 9th 2008
     

    I have a normal has_many relation.

    In my edit controller can't delete associations.

    In my controller I have

    foreach ($_SESSION['objtoDelete'] as $key => $obj_det) { $_to_delete = new $this->myDetail($obj_det); $this->MyMaster->my_detail->delete($_to_delete); }

    but I get this message

    Warning: Unable to set "active_records" table for the model "ActiveRecord". There is no "active_records" available into current database layout. Set AK_ACTIVE_RECORD_VALIDATE_TABLE_NAMES constant to false in order to avoid table name validation in /usr/home/simone/akelos/lib/AkActiveRecord.php on line 2445 Fatal error: Ooops! Could not fetch details for the table . in /usr/home/simone/akelos/lib/AkActiveRecord.php on line 2624

    if I change the line 3 with this

    $this->MyMaster->my_detail->add($_to_delete);

    it works and when I call MyMaster->save () the children objects are added.

    Where am I wrong ?

    -- Simone

    • CommentAuthorKaste
    • CommentTime4 days ago
     

    You can't delete an unsaved record.

     $_to_delete = new $this->myDetail($obj_det);
    

    It should be

    $_to_delete = $this->myDetail->find($obj_det['id']);
    

    or something like that, unless I misunderstood your code.

Add your comments
    Username Password
  • Format comments as