Skip to content

Instantly share code, notes, and snippets.

@renan
Created October 17, 2011 13:08
Show Gist options
  • Save renan/1292567 to your computer and use it in GitHub Desktop.
Save renan/1292567 to your computer and use it in GitHub Desktop.

I am running 2.0 on my app for almost 1 month. But when changed to 2.0 stable, got:

Fatal error: Nesting level too deep - recursive dependency? in /var/git/cakephp2.0/lib/Cake/Model/Datasource/DboSource.php on line 1501

Charging line 1491 from 'table' => $linkModel to 'table' => $this->fullTableName($linkModel) solved the issue.

On RC3, or pre-stable, this change was not present, but got introduced when merged 1.3 into 2.0 Tracked down to this commit: https://github.com/cakephp/cakephp/commit/d489d490

Why does the line 1491 does not use $this->fullTableName but line 1483 does?

@markstory
Copy link

I must have missed 1491. The removal of fullTableName() was to consolidate where table prefixes were applied. The idea being that table prefixes shouldn't be applied until the query is rendered. There were issues with join tables getting prefixes applied twice sometimes. And also you'd need to manually include the table prefix for query defined joins.

@renan
Copy link
Author

renan commented Oct 17, 2011

To avoid the "Nesting level too deep" error could we use $linkedModel->useTable instead of $linkedModel?

@markstory
Copy link

useTable might loose the models->tablePrefix. Is there something that is causing the loop?

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