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 bind to column value with Builder

Hello,

I want to bind a value to column with Phalcon\Mvc\Model\Query\Builder

public function findSomething($value)
{
    $this->getModelsManager()->createBuilder()
    ->columns(':value: as someValue, ...')
    // ->bind(['value' => $value])  // like this
    ->from(...)
    ->where(...)
}

Is there any way?

Best Regards,



85.9k
Accepted
answer
edited Apr '18

Hmm, you really want to have dynamic column names?

Try like this:

->execute([
    'value' => $value,
])
edited Apr '18

Thank you for your response.

I want to have dynamic column values. (not names)

In my example, column name is someValue.

Anyway, I will try it later.

Thanks.

Hello Nikolay,

It worked fine.

Thank you so much.