How to delete an MPTT Node

By Andy, filed under CakePHP, Tools, ACL, Tips, MPTT, Hacks, SQL

If you use MPTT tables anywhere (The cake acl system uses it) you may have found that when you delete an entry, the lft and rght fields for the neighouring nodes don't get updated. This may have rather dire concequences ;)

There is an open ticket for how to delete from the cake acl tables, but as it is potentially quite generic, I thought I'd include the (potential)...

read more1 comment

  • Where did I put that call?

    By Andy, filed under CakePHP, Tips, Hacks

    In the site update, this little tidbit went missing, so here it is again:

    function pr($var) {
        if (DEBUG > 0) {
            
    
    $array = debug_backtrace();
            echo(str_replace(ROOT, "", $array[0]['file'])." (line ".$array[0]['line'].")");
       
    
         echo "<pre>";
            print_r($var);
            echo "</pre>";
        }
    }
    
    1. function pr($var) {
    2. if (DEBUG > 0) {
    3. $array = debug_backtrace();
    4. echo(str_replace(ROOT, "", $array[0]['file'])." (line ".$array[0]['line'].")");
    5. echo "<pre>";
    6. print_r($var);
    7. echo "</pre>";
    8. }
    9. }
    10.  

    With this minor change, you can see where your debug calls are...

    read more0 comments

«  »