2010年11月29日星期一

Re: [fw-mvc] Re: How to instantiate a model class to use its functions, standard solution?

If in doubt, use a model ;)

On 29 November 2010 16:53, Rishi Daryanani <rishijd@yahoo.com> wrote:

> Hi David,
>
> Thanks for your reply, but I'm afraid I'm back to square one on confusion
> :(
> Currently I do use controllers, big controllers with several of its own
> functions within the ProductlistAction() function, to do everything the
> "products list" pages do. That includes getting the products from the
> database,
> and generating each filter as a side menu on the page. Each "filter" comes
> from
> its own two tables, e.g. colour has a "colour" table and a
> "colour_language"
> linked table for a description per language. "Length" has a "length" table
> with
> a "length_language" table for a description per language. (Multi lingual
> site).
> There are on any given products list page, more than 5 filters per page.
>
>
> I have no problem in sorting it all out via controllers, as that is what
> we've
> been doing all along. I'm just trying to understand if there is a better
> way to
> separate code or classes, or if using a plain old PHP class will simply
> solve my
> problem. I know it will actually, but I just want to hear from all the
> experienced people here on how THEY would do it, or if they needed to edit
> a
> site which uses controllers the way I described (without models), what
> would
> THEY do to improvise the code, let's say, as a quick start for the filters
> /
> situation I described in my previous mail?
>
> Many thanks,
> Rishi
>
>
>
>
>
> ________________________________
> From: David Muir <davidkmuir+zend@gmail.com <davidkmuir%2Bzend@gmail.com>>
> To: fw-mvc@lists.zend.com
> Sent: Mon, November 29, 2010 6:19:36 PM
> Subject: [fw-mvc] Re: How to instantiate a model class to use its
> functions,
> standard solution?
>
>
> I would not say that "filter" is a model. It is, as it's name implies, a
> filter. :-)
>
> Colour and length are attributes that you'd be filtering. In your case, the
> filter happens to be expressed via sql table joins. That is, unless you're
> selling air filters, in which case I think I've misunderstood your problem
> :-)
>
> Unless you've got a big system with many (relatively independent) parts,
> then modules is probably not what you need. AFAICT, other than organising
> and grouping code, they don't offer much of an advantage over just using
> controllers.
>
> David
> --
> View this message in context:
>
> http://zend-framework-community.634137.n4.nabble.com/How-to-instantiate-a-model-class-to-use-its-functions-standard-solution-tp3054833p3063519.html
>
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>
>
>
>

没有评论: