0

How do I get the 'params' from a query object in CakePHP 3?

$response = $this->getTable()->find();
// there are beforeFinds...etc that make this more complex

When I debug the $response, I get this (:

// ...
'(help)' => 'This is a Query object, to get the results execute or iterate it.',
'sql' => 'SELECT .... WHERE ... article_id = :c2',
'params' => [
    ':c0' => [
        [maximum depth reached]
    ],
    ':c1' => [
        [maximum depth reached]
    ],
    ':c2' => [
        [maximum depth reached]
    ]
],
// ...

I'd like to know what the value of :c2 is, but I can't seem to get the params to debug.

I've tried these:

\Cake\Error\Debugger::log($response->params);
\Cake\Error\Debugger::log($response->params());
\Cake\Error\Debugger::log($response['params']);
\Cake\Error\Debugger::log($response->getParams());
\Cake\Error\Debugger::log($response->getQueryParams());

But none work.

3 Answers 3

0

By increasing the depth of the debug, I was able to see dditional information, including the values of the :c2

\Cake\Error\Debugger::log($response, 'debug', 4); // default depth is 3
Sign up to request clarification or add additional context in comments.

Comments

0

You should be able to get them via $response->valueBinder()->bindings().

Comments

0

You can use __debugInfo() method:

$result = $this->Pages->find()->where(['is_public' => 1]);

dd($result->__debugInfo()['params']);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.