Gabriel Malkas wrote:
>
> Dave kennedy a écrit :
>> Now I am tearing my hair out over this. I started refactoring a small
>> project
>> to 1.8. Before I had included my models directory in the include path so
>> they could be called whenever wherever.
>>
>> My structure is
>>
>> application
>> - controllers
>> - models
>> - Sample.php
>> - forms
>> - configs
>> - layouts
>> - views
>> - Bootstrap.php
>> public
>> - .htaccess
>> - index.php
>>
>> Im not using a modular structure and do not wish to. I read up on Zend
>> Application and implemented it with the bootstrap I got a test project
>> going, my problem is I can no longer autoload my model classes
>>
>> before I would use $sample = new Sample();
>>
>> Now I can no longer get that working. I know it is to do with the
>> namespace
>> autoloading but just cannot get my head round it.... any help would be
>> greatly appreciated.
>>
>> Dave
>>
>>
>>
> Dave,
>
> I don't think it is the best solution to this problem, but it works :
> add a namespace to your models :) It makes sense. For example, if you
> have a model User or whatever, and your application is called App, then
> call your model App_User. Then, just add the namespace App to your
> configuration file.
>
> I am not sure it is a good practice though. Maybe it is against Zend
> Framework philosophy, I don't know. It is up to you ;)
> Regards,
> Gabriel Malkas, from France.
>
>
>
Thank you for the reply Gabriel. I had actually done this and I guess I must
have too much rails in me I really do not like $user = new App_User(); As I
feel it would not make my code as portable as I would like. Ideally I would
like to keep $user = new User();
I think my answer lies in here somewhere
http://framework.zend.com/manual/en/zend.loader.autoloader-resource.html#zend.loader.autoloader-resource.usage
http://framework.zend.com/manual/en/zend.loader.autoloader-resource.html#zend.loader.autoloader-resource.usage
but not sure... ill maybe look at it after my head has cleared slightly :)
Thanks again for the reply.
--
View this message in context:
http://www.nabble.com/Autoloading-models-tp23330806p23331142.html
Sent from the Zend Framework mailing list archive at Nabble.com.