When using Linkable behavior in CakePHP 1.3.13 tablenames in SQL instruction generated by a "find" statement produces errors because tablenames include table prefix twice:
Prefix: tbl
Model: User
Table: user
Generated SQL statement produces: 'tbl_'tbl_user''
The solution is to modify the Linkable behavior in the 140 line:
if (empty($options['table'])) {
$options['table'] = $db->fullTableName($_Model, true);
}
With:
if (empty($options['table'])) {
$options['table'] = $_Model->table;
}
This is because if you see CakePHP 1.3.13 changelog:
http://cakephp.org/changelogs/1.3.13
Now calling fullTableName is not need internally anymore while translating a join:
[3becdc5] Removing uses of db->fullTableName() when creating joins. Refs #2074
cakephp/cakephp@3becdc5
[6afa21c] find with joins option now respects prefix set in database configuration, fixes #1517 test to prove validity of ticket #1517
cakephp/cakephp@6afa21c