2008年12月6日星期六

RE: [fw-db] Using a zend framework model question

Hi,

that's what the whole model thing is about :-). But you should notice that
model has a not very strong support in ZF. You need to require its classes
into your controllers manually (implement something like _getModel()) -
there is no Zend_Loader method for models autoload. You should also notice
that a model class is not derived from any Zend Framework class.

See
http://framework.zend.com/docs/quickstart/create-a-model-and-database-table

Compared with another parts of ZF, model is a little bit conufusing stuff
(especially if you'd like to use Active Record concept).

Jiri Helmich

-----Original Message-----
From: vladimirn [mailto:nezaboravi@gmail.com]
Sent: Saturday, December 06, 2008 11:23 AM
To: fw-db@lists.zend.com
Subject: [fw-db] Using a zend framework model question


I would like to use models which i never used before.
Usualy i am doing all DB related things inside my controller.
But i was thinking in my sleeples last night that using a model would be
much better :)
Is it possible to do something like this?
class someController extendes Zend_Controller {

indexActio(){
}
viewAction(){
there i would like to grab some method from my model...
}
editAction(){
there i would like to grab another method from model...
}
}

Model
******
class someModle extends Zend_db...{
protected $_name = 'news';
public function viewNews ($newsID){
return news
}
public function editNews($newsID){
edit news
}
.......

Thank you,
V
--
View this message in context:
http://www.nabble.com/Using-a-zend-framework-model-question-tp20868626p20868
626.html

Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: