Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Fixed issue where table alias is used in FROM in SQL query#16

Open
stephen1807 wants to merge 1 commit into
josegonzalez:masterfrom
stephen1807:develop
Open

Fixed issue where table alias is used in FROM in SQL query#16
stephen1807 wants to merge 1 commit into
josegonzalez:masterfrom
stephen1807:develop

Conversation

@stephen1807

@stephen1807 stephen1807 commented Jun 25, 2018

Copy link
Copy Markdown

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

@josegonzalez

Copy link
Copy Markdown
Owner

Do you mind also fixing the phpunit integration so tests actually run, as well as adding a test for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants