Skip to content

Empty table alias in query, in Builder method addFrom() #14366

New issue

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

Closed
Jeckerson opened this issue Sep 8, 2019 · 1 comment
Closed

Empty table alias in query, in Builder method addFrom() #14366

Jeckerson opened this issue Sep 8, 2019 · 1 comment
Labels
bug A bug report status: low Low

Comments

@Jeckerson
Copy link
Member

Found bug in Phalcon API (https://github.com/phalcon/phalcon-api/blob/master/library/Traits/QueryTrait.php#L89)

$builder = new Phalcon\Mvc\Model\Query\Builder();
$builder->addFrom(Users::class);

Which generates incorrect query

SELECT [].* FROM [Niden\Models\Users] AS [] WHERE ((username = :username:) AND (password = :password:)) AND (status = :status:)

It works correctly if specify second parameter of addForm() method.

$builder = new Phalcon\Mvc\Model\Query\Builder();
$builder->addFrom(Users::class, 'table1');

Details

  • Phalcon version: (4.0-beta.2)
  • PHP Version: (7.2)
  • Operating System: Ubuntu 18.04
  • Installation type: Compiling from source
  • Zephir version (if any): -
  • Server: Nginx
  • Other related info (Database, table schema): MySQL
Jeckerson added a commit to phalcon/rest-api that referenced this issue Sep 8, 2019
@Jeckerson Jeckerson changed the title Empty alias query in Builder method addFrom() Empty table alias in query, in Builder method addFrom() Sep 8, 2019
@niden niden added 4.0 labels Sep 8, 2019
@ruudboon ruudboon mentioned this issue Sep 12, 2019
5 tasks
@sergeyklay
Copy link
Contributor

Fixed in the 4.0.x branch. Feel free to open a new issue if the problem appears again. Thank you for the bug report.

@niden niden added bug A bug report status: low Low and removed Bug - Low labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
None yet
Development

No branches or pull requests

3 participants