Created
May 14, 2018 19:44
-
-
Save lorenzo/39b3297cfba428243c5b875d48d0d151 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\ORM; | |
use Cake\Error\Debugger; | |
use Cake\ORM\Query; | |
class DebuggingQuery extends Query | |
{ | |
public function __construct($connection, $table) | |
{ | |
parent::__construct($connection, $table); | |
$this->addComment(); | |
} | |
public function addComment() | |
{ | |
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); | |
$comment = $trace[4]['class'] . '::' . $trace[4]['function'] . '@' . $trace[3]['line']; // change the numbers at will until you get the right spot | |
$this->modifier(['/* ' . $comment . ' */']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment