« Return to Thread: Shared Models in Different Modules
The only reason to make that model classes named that way is to avoid namespace collisions, but you can name that classes as you like. The problem will appear if someday a class named Story appears (from another package or external lib), any attempt to use two classes with the same name will throw an error.On Dec 3, 2007 4:51 PM, Whitcraft, Jon <jwhitcraft@...> wrote:Xavier,
I ran into that problem too. I just refactored the class name to be new_Models_Story which makes no sense but it works for right now and going back later to refactor once it gets all figured out wont be too hard as the Zend Neon Beta does a good job of finding all the occurrences of that class.
Cheers
Jon Whitcraft
Indianapolis Motor Speedway
jwhitcraft@...Phone: (317) 492-8623 :: Fax: (317) 492-6419
From: Xavier Vidal Piera [mailto:xavividal@...]
Sent: Monday, December 03, 2007 10:17 AM
To: Whitcraft, Jon
Cc: Marko Korhonen; fw-mvc@...
Subject: Re: [fw-mvc] Shared Models in Different Modules
Yes
But i remember to do that in lowercase (module names are in lowercase), so i have all the folder structure in lower case.
At this moment, any way to organize better the model classes will be apreciated.
On Dec 3, 2007 2:09 PM, Whitcraft, Jon <jwhitcraft@...> wrote:
So if I understand you correctly, I should be able to do this
$story = new News_Models_Story();
Where this is my directory structure:
./modules/
./news/
./models/
Story.php
Correct?
Jon Whitcraft
Indianapolis Motor Speedway
jwhitcraft@...Phone: (317) 492-8623 :: Fax: (317) 492-6419
From: Xavier Vidal Piera [mailto: xavividal@...]
Sent: Monday, December 03, 2007 7:54 AM
To: Marko Korhonen
Cc: fw-mvc@...
Subject: Re: [fw-mvc] Shared Models in Different Modules
I'm treating model classes as framework classes using the conventional naming to avoid namespace collisions, so all the model classes common to all the application are stored in default/models/ and are named Default_Models_* so they can be easily be localized. Of course, inside the model class the "real name" is set with protected $_name.
You can have model classes in another modules and be namespaced accordingly.
The autoload function will find this classes the same way it finds the Zend Libs and other classes.On Dec 3, 2007 6:35 AM, Marko Korhonen <marko.korhonen@...> wrote:
Hi to all!
I made one folder to all my models, and I appended the include_path with the
path to this folder.
$models_path = APPLICATION_PATH ."My_Application/Model/";
// include $models_path to include_path somewhere
Then where ever in actions I might need some model I just make:
$model = new Page();
or something like that...
So these models are shared by all controllers & actions but not by all my
different applications.
br,
Marko
--
View this message in context: http://www.nabble.com/Shared-Models-in-Different-Modules-tf4932443s16154.html#a14124197
Sent from the Zend MVC mailing list archive at Nabble.com.
--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
xavividal@...
xvidal@...
http://web.xaviervidal.net
610.68.41.78********************
********************
This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted.
********************
********************
--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
xavividal@...
xvidal@...
http://web.xaviervidal.net
610.68.41.78
--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
xavividal@...
xvidal@...
http://web.xaviervidal.net
610.68.41.78
« Return to Thread: Shared Models in Different Modules
| Free embeddable forum powered by Nabble | Forum Help |