Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to get bind params from a builder?

i found this property, but it not public:

https://github.com/phalcon/cphalcon/blob/9073ca32cd23c19f958cabd8373575a22db56d02/phalcon/mvc/model/query/builder.zep#L95

so, how can i get bind params from a builder?



78.9k
Accepted
answer
namespace whatever\Plugins\Query;

class Builder extends \Phalcon\Mvc\Model\Query\Builder {

    public function __construct($params = null, $di = null){
        parent::__construct($params, $di);
    }

    public function getBindParams(){

        return $this->_bindParams;
    }
}

and then you use your own class instead of Phalcon one



695
edited Mar '18

finally, i use this code:

$class = new \ReflectionClass(get_class($builder));
$bindParams = $class->getProperty('_bindParams');
$bindParams->setAccessible(true);
$bind = $bindParams->getValue($builder);