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

ClassRegistry::init caching problem and error message #2

Closed
wants to merge 1 commit into from

Conversation

vstabile
Copy link

ClassRegistry::init was returning a cached instance of a wrong model, as in ProLoser/CakePHP-Cacheable#1
Also updated error's __() function to cakephp 2.0

@lecterror
Copy link
Owner

Hi vstabile,

I'm afraid I can't accept this change; ClassRegistry::init() is still the proper way to get an instance of a model. If you're getting the wrong result it's probably an issue with the Cacheable behaviour or your own code, not with ClassRegistry::init().

Also, you should probably use App::uses() in place of App::import().

I'm going to close this pull until you can prove that the problem is in this plugin.

Thanks for pointing out the problem with __() though, it seems it's wrong everywhere.

@lecterror lecterror closed this Sep 26, 2011
@vstabile
Copy link
Author

No problem, it was more like a workaround. I took a closer look and the issue persists even without the Cacheable behavior, I just can't figure out why ClassRegistry::init('ModelName') keeps returning an instance of a model RELATED to 'ModelName' instead of 'ModelName' itself. I will come back to you if I get this issue clearer.

@lecterror
Copy link
Owner

Maybe you should check your models' names? If you've copy-pasted their code you might have missed something, it has happened before :) In any case, good luck!

@vstabile
Copy link
Author

Just found the problem, you were right after all. I had already checked the names of my classes, but there was a mistake in the $hasMany array that really messed with classregistry::init. I saw you've fixed the internationalization function everywhere, thanks!!!

@lecterror
Copy link
Owner

Great to hear it, good luck with your project!

lecterror pushed a commit that referenced this pull request Dec 13, 2015
stosef pushed a commit to the-kbA-team/cakephp-filter-plugin that referenced this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants