Skip to content
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

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

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

Comments

@Jeckerson
Copy link
Member

@Jeckerson Jeckerson commented Sep 8, 2019

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 this to To do in 4.0 Release via automation Sep 8, 2019
@ruudboon ruudboon referenced this issue Sep 12, 2019
4 of 5 tasks complete
@ruudboon ruudboon moved this from To do to In progress in 4.0 Release Sep 12, 2019
@sergeyklay

This comment has been minimized.

Copy link
Member

@sergeyklay sergeyklay commented Sep 12, 2019

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.

@sergeyklay sergeyklay closed this Sep 12, 2019
4.0 Release automation moved this from In progress to Done Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4.0 Release
  
Done
3 participants
You can’t perform that action at this time.