Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorhpatoio
     

    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
     

    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.