DB_dsql::debug PHP Méthode

debug() public méthode

This is identical to AbstractObject::debug(), but as an object will refer to the $owner. This is to avoid string-casting and messing up with the DSQL string.
public debug ( boolean | string $msg = true )
$msg boolean | string "true" to start debugging
    public function debug($msg = true)
    {
        if (is_bool($msg)) {
            $this->debug = $msg;
            return $this;
        }
        if (is_object($msg)) {
            throw $this->exception('Do not debug objects');
        }
        // The rest of this method is obsolete
        if (isset($this->debug) && $this->debug || isset($this->app->debug) && $this->app->debug) {
            $this->app->outputDebug($this->owner, $msg);
        }
    }

Usage Example

Exemple #1
0
 /**
  * Turns debugging mode on|off for this model. All database operations will be outputed.
  *
  * @param bool $enabled
  *
  * @return $this
  */
 public function debug($enabled = true)
 {
     if ($enabled === true) {
         $this->debug = $enabled;
         if ($this->dsql) {
             $this->dsql->debug($enabled);
         }
     } else {
         parent::debug($enabled);
     }
     return $this;
 }