We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I just installed this library, but I encountered a problem with the examples in the documentation.
I tested the example of the LEFT JOIN, but this didn't work:
LEFT JOIN
<?php use NilPortugues\Sql\QueryBuilder\Builder\GenericBuilder; $builder = new GenericBuilder(); $query = $builder->select() ->setTable('user') ->setColumns([ 'userId' => 'user_id', 'username' => 'name', 'email' => 'email', 'created_at' ]) ->orderBy('user_id', OrderBy::DESC) ->leftJoin( 'news', //join table 'user_id', //origin table field used to join 'author_id', //join column ['newsTitle' => 'title', 'body', 'created_at', 'updated_at'] ) ->on() ->equals('author_id', 1); //enforcing a condition on the join column $query ->where() ->greaterThan('user_id', 5) ->notLike('username', 'John') ->end(); $query ->orderBy('created_at', OrderBy::DESC); echo $builder->writeFormatted($query);
With some tweaks I managed to make it work, and it appears like so:
<?php use NilPortugues\Sql\QueryBuilder\Builder\MySqlBuilder; use NilPortugues\Sql\QueryBuilder\Syntax\OrderBy; use NilPortugues\Sql\QueryBuilder\Syntax\Where; $builder = new MySqlBuilder(); $query = $builder->select(); $query->setTable('user') ->setColumns([ 'userId' => 'user_id', 'username' => 'name', 'email' => 'email', 'created_at' ]) ->orderBy('user_id', OrderBy::DESC); $query ->leftJoin( 'news', //join table 'user_id', //origin table field used to join 'author_id', //join column ['newsTitle' => 'title', 'body', 'created_at', 'updated_at'] ) ->on() ->equals('author_id', 1) //enforcing a condition on the join column ->end(); $query ->where() ->greaterThan('user_id', 5) ->notLike('username', 'John') ->end() ->orderBy('created_at', OrderBy::DESC); echo $builder->writeFormatted($query);
Is it different because I used MySqlBuilder or is there something wrong I can't understand?
The text was updated successfully, but these errors were encountered:
I have same problem with example. Fatal error: Uncaught Error: Call to undefined method NilPortugues\Sql\QueryBuilder\Syntax\Where::where()
edit: I fixed my problem
$query->leftJoin( 'news', //join table 'user_id', //origin table field used to join 'author_id', //join column ['newsTitle' => 'title', 'body', 'created_at', 'updated_at'] ) ->on() ->equals('author_id', 1)->end(); //enforcing a condition on the join column $query ->where() ->greaterThan('user_id', 5) ->notLike('username', 'John') ->end();
line: ->equals('author_id', 1)->end();
Sorry, something went wrong.
No branches or pull requests
Hello, I just installed this library, but I encountered a problem with the examples in the documentation.
I tested the example of the
LEFT JOIN
, but this didn't work:With some tweaks I managed to make it work, and it appears like so:
Is it different because I used MySqlBuilder or is there something wrong I can't understand?
The text was updated successfully, but these errors were encountered: