Zend delete model - php

Good day everyone.
I am frontend developer but I have to make slight adjustments in the backend, built with Zend Framework.
I have a controller CalendarController.php, and wanted to make a relative model, called Calendar. The model was instantiated as
`class Project_Model_Calendar extends Project_Model_Abstract`
in a file called Calendar, placed in Model directory.
Later on I figured out that I dont need this model, so I simply deleted it, along with only reference to it in the controller. (it was used like this
`$this->form = new Project_Model_Calendar();`
)
Apparently there is some memory cache or config file that saved this model, and tries to load it every time.
I get the following error
Zend_Session::start() Error #2 include_once() [function.include]: Failed opening 'Project/Model/Calendar.php' for inclusion
Why do I get this error if I dont use the model anywhere? How can I clear this cache of loaded models?
Could you please help me with it? Please forgive me for asking such unspecific questions, but I need to fix it, and Zend framework is still a mystry for me most of the time.

Including the file will probably still result in an error, even if you're not using it. Make sure it isn't hardcode included in the paths in your php.ini, httpd.conf, or .htaccess files.

Related

Yii autoload error

I am working on a project, that I have inherited from several previous teams, thus all the ins and outs of all the workings is beyond my knowledge. But I'm trying to implement a new class EmailListener and it is in the file EmailListener.php under ../protected/controllers. When Try to call this class I get an error
include(EmailListener.php): failed to open stream: No such file or directory
from within yiiBase autoload line 421
else
421 include($className.'.php'); //this line
I have looked around extensively and the only suggestion is to check for case sensitivity. Which I have, multiple times. To the extent of copying the entire path into the class name and deleting everything around "EmailListener" to ensure that there are no typos that I am not seeing. I have also tried different manual includes of my file before the command is run to call it and that just crashes the whole website. Are there any other things I could be doing wrong? Is there any other code I can present?
Thank you for any help, I'm pulling my hair out.
First off, the protected/controllers directory should only be used for controllers. Extra classes you create for other things generally go in protected/components.
Your protected/config/main.php (and protected/config/console.php if you're doing console stuff) should have an import section. By default, one of the things imported is "application.components.*". If that's the case, than any class you put in protected/components will auto-load when you ask for it.

How does CakePHP connect files in different directories?

This is probably very trivial but because I'm new I just don't get it.
I can see the notion of App::uses at the beginning of every file but how does the file know where App is?
There are no includes anywhere and to my understanding there is one autoloader somewhere in lib, does that mean that one autoloader in one file is responsible for loading all the classes (if instantiated)?
I tried reading this part of the manual but still failed to understand how it works.
Also read some material on the spl_autoload_register function itself but no avail.
I'd really appreciate it if someone could help me understand how the files communicate with eachother.
Look at App::load(), it's doc block explains it:
Method to handle the automatic class loading. It will look for each
class' package defined using App::uses() and with this information it
will resolve the package name to a full path to load the class from.
File name for each class should follow the class name. For instance,
if a class is name MyCustomClass the file name should be
MyCustomClass.php.
And look at the frameworks core file lib/Cake/basics.php:
spl_autoload_register(array('App', 'load'));
It registers that method as auto loader.

Model Missing, Codeigniter

I am using and have been using the framework CodeIgniter for a while. It works perfectly on my localhost, once I upload it to a server it gives the following error message
Unable to locate the model you have specified: auth_model
To point it out, it works on my apache perfectly, do you have any idea to what the problem can be? I am talking with customer support of the webbhotel, but they can't seem to find anything on their end.
Thanks in advance.
Edit: It manages to load many different files, the session library, my own controllers, helpers and view files. It just models that it stops at, I've named them all 'Auth_model.php", 'Login_model.php' etc. The models themselves are declared class Auth_model extends CI_Model {}
Sounds like a path issue,
I would first check where your starting at and get some data to compare with
CodeIgniter FCPATH and APPATH are both set in the main index.php file,
FCPATH = root
APPATH = application folder
Find out what your paths are set to, check your config/config.php file make sure you have correct info there.
Just a thought, are you using a common auth library? Sucb as freak/ion/bit/etc auth's
The session error, is being caused by echoing data you can google the error and get a decent understanding of the error from there.
As it turns out the webhotel (one.com) got a delay when you upload, hence it was a bit troublesome to actually troubleshoot it, but here it goes. Every file name except for the exception of MY_Controller needs to be in lower cases. So the answer was pointed out by some people.
The problem is with codeigniter because it looks for lower cases only in some cases. So yeah, models should be in lower cases from now on!

Are there codeigniter controller sub-directory limits?

Greetings,
I've encountered a seemingly bizarre issue, and was wondering if anyone is able to shed a light.
I created a simple controller two levels down from the traditional /application/controllers/ directory and I'm seeing a CI-generated 404 when hitting said controller.
To elaborate, my directory structure is as follows:
/ci/application/controllers/dir1/dir2/myfile.php
The file itself has a simple function with an echo statement. When I move said file up one level such that it is located in:
/ci/application/controllers/dir1/myfile.php
It works.
I've tried changing the name of the "dir2" directory in the example above, the name of the controller, the names of the functions within the controller -- to no avail. I'm able to hit the same php file without going through the Code Igniter framework, and I'm on a Windows machine working normally so I can't imagine this to be a permissions-related issue.
I'm led to think that CI simply isn't willing to go into the controllers directory more than one level. Is this possible, or am I missing something?
Try this out: http://glennpratama.wordpress.com/2009/10/20/multi-level-subfolder-for-controller-in-codeigniter/
Basically, you need to override the default codeigniter router with your own MY_Router class
"Out of the box", Codeigniter only supports a single level directory structure for Controllers.
There are ways to extend the default Router class to enable this feature.

Error with propel-generate-crud in Symfony 1.0

When I try to generate a CRUD test for a new project I am getting a PHP Warning and a Fatal Error.
The errors relate to files that it cannot find, however, I have checked and the files are definitely there.
The error text is 'require_once(lib/model/map/QuestionMapBuilder.php): failed to open stream: No such file or directory in c:\webroot\askeet\lib\model\om\BaseQuestionPeer.php on line 547'
What details of my project should I check?
I think it's a problem with your include path.
Check it, the require_once() call is looking for lib/model/map/QuestionMapBuilder.php
But your include_path is C:\webroot\askeet\lib
Which, when resolved together into a full path, would look like this
C:\webroot\askeet\lib\lib\model\map\QuestionMapBuilder.php
So, I think your solution is to add C:\webroot\askeet to your include path.
You are generating crud for the Question model class but it doesn't seem to exist. Documentation on using the crud generator
First you must use the schema.yml file to define your database, and run
./symfony propel:build-model
to generate your model files. (this will generate lib\model\map\QuestionMapBuilder.php)
I finally tracked down the issue. In my PHP.ini files, they were setup wit the default UNIX file path settings.
Weirdly nothing had ever been broken by this incorrect configuration. Plus, everything in Symfony had worked up until now.
I have switched to Windows style file_path and all is well again.
Thanks for all the answers!

Categories