2008年12月6日星期六

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

is't that the whole idea of the models? that you seperate your code from all
the db stuff?

e.g.

viewAction() {
newsModel = new NewsModel();
news = newsModel->viewNews($id);
}

Instead of coding all your model functions, you can also use fetchAll,
delete, insert, updat, and mutch more... But I asume you're going the read
the manual first :-D


vladimirn wrote:
>
> 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
>


-----
http://www.phpscriptor.com/ http://www.phpscriptor.com/
--
View this message in context: http://www.nabble.com/Using-a-zend-framework-model-question-tp20868626p20868869.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: