> I've created some models following this documentation page,
> I need to get some content with fetchAll using some filter ( where this
> = 'that' ecc ) but the fetchAll
> method doesn't accept any arguments: it is because it is just an example
> ( and I have to edit fetchAll by myself providing arguments ) or
> is there any reason?

Yes, it doesn't have any arguments because the example doesn't need it. 
You create exact that methods that you need and within this methods you 
generate your output and return it. As you can see in the section where 
the class Application_Model_GuestbookMapper is described it generates 
it's data with a db table and returns it. If you want to have filtering 
you can easily extend the method signature like fetchAll($filter) and 
then you use this value with the db table (or you do a select or 
however). You can also make up a new method like 
fetchAllBuddiesById($id) that makes a different call to the database 
(and includes cache or something).

> And also, find method requires second parameter do be a Model instance, why?

I don't really know that example (my models are usually very much 
simpler and they exactly fit to my business logic) but with this you can 
inject an already existing instance into the method. But...

> Cannot it be instanciated within the method ( like it happens in fetchAll )?

Yes you can also create the instance within the method. For sure - why 
not. It's a matter of the architecture.

> Maybe they are just dumb questions, sorry about that!

Hope that helps a little bit for that situation.

You will see if you search the internet for the M in MVC you will find a 
loooot of explanations what is, what not, what they wish that it is, 
what they think what it is, etc .

Remember a model is free to be filled by you. It is just a class that 
encapsulated data. If you want to have a database behind thats ok, an 
internet service? Also ok. Static data (seldom) but why not.

I came to that point that I try to write my models around/with some 
design patterns but they are usually very near to the business logic and 
not to be ment very reusable (it is very nice if they are but they don't 
have to :-)


-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Model-documentation-page-explanation-needed-tp2289198p2290515.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to