cakephp-entity
cakephp-entity copied to clipboard
Fixed issue where table alias is used in `FROM` in SQL query
Problem:
CakePHP: 2.9.9 PHP: 7.0.12
When Class A
extends Table
from Entity.ORM
and Class B
has belongsTo
association to Class A
, performing SQL query in Class B
would result table alias used as table name in SQL query. This is an issue if the belongsTo
group name is not the same as associated model name.
E.g.
$belongsTo = [
'AnotherUser' => [
'className' => 'User',
'foreignKey' => 'another_user_id',
]
]
Fix:
Removed assigning alias to name
Do you mind also fixing the phpunit integration so tests actually run, as well as adding a test for this?