Y
Y
yv19952016-10-05 08:03:47
Magento
yv1995, 2016-10-05 08:03:47

What are collections in magento?

In simple terms, what are collections in magento? Google does not provide a definition =)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2016-10-05
@yv1995

In Magento, a collection is a list of elements (an array). All collections are children of Varien_Data_Collection. This class implements the IteratorAggregate and Countable interfaces. IteratorAggregate allows you to use a collection in a foreach loop. A good example of a collection is a customer list (Mage_Customer_Model_Resource_Customer_Collection). This class also inherits Varien_Data_Collection_Db, which allows you to work with the database, make queries and get the result as a collection. An example of working with this collection can be found in the Mage_Customer_Model_Customer_Api method items($filters).

I
imdeveloper, 2016-10-05
@link_web

Collections are not Magento at all. If you think that just at first glance it seems that the collection is just some kind of "collection" of dresses, then no. A collection is an architectural element that makes it possible to conveniently work with a collection of objects by implementing methods that are not inherent in any of the objects.
UPD: devdocs.magento.com/guides/m1x/magefordev/mage-for...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question