PDO - Join in a function

Asked

Viewed 27 times

1

I am inserting a new query in a functional system, however I am not able to understand how to insert a JOIN , I saw that there is the Function, I just can’t implant.

I tried to run like this

$query_cliente  = QB::table('tbl_reclamacoes')->join('tbl_usuarios','id_usuarios','id_cadastro_reclamacoes')->where('id_reclamacoes','=',$get_id);

But it didn’t work, I tried other ways, but I guess I didn’t understand

 public function join($table, $key, $operator = null, $value = null, $type = 'inner')
{
    if (!$key instanceof \Closure) {
        $key = function ($joinBuilder) use ($key, $operator, $value) {
            $joinBuilder->on($key, $operator, $value);
        };
    }


    $joinBuilder = $this->container->build('\\Pixie\\QueryBuilder\\JoinBuilder', array($this->connection));
    $joinBuilder = & $joinBuilder;       
    $key($joinBuilder);
    $table = $this->addTablePrefix($table, false);       
    $this->statements['joins'][] = compact('type', 'table', 'joinBuilder');
    return $this;
}
  • Why not do the JOIN directly on query SQL?

  • For being in PDO the other classes of WHERE , ORDER BY and etc already work like this, so by the logic that has the class of JOIN, I would like to leave as standard, even could change, already put working, but so I think it starts polluting what is already ready

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.