I can’t understand some strange thing.
I have folder structure:
application/
controllers/
forms/
models/
views/
I added Service folder to ‘models’ folder and create file in it:
models/
Service/
User.php
models/Service/User.php:
<?php
class Model_Service_User {}
In IndexController (for testing):
....
$test = new Model_Service_User; // It's works
....
But I don’t understand why if I add ‘Mapper’ folder as ‘Service’ one, it is not working..
models/
Mapper/
User.php
models/Mapper/User.php:
<?php
class Model_Mapper_User {}
And in IndexController:
....
$test = new Model_Mapper_User; // Fatal error: Class 'Model_Mapper_User' not found
....
I try to create another folders like ‘Map’, ‘Maps’ and so, they are working ok. But what is wrong with Mapper??
This is because there is a resource autoloader definition for
Model_Mapperalready defined inZend_Application_Module_Autoloader.The autoloader looks for these class files in
/models/mappers.If you want to remove this mapping, in your
Bootstrapclass, try this…… or you could just put your mappers in
models/mappers.