Using models to fetch data is one of the most important aspects of any CakePHP application. As such, a good use of the find functions the framework provides can certainly guarantee the success of our application, and as importantly ensure that our code is readable and maintainable.
CakePHP provides the following basic find types:
first
: To find the first record that matches the given find options.list
: To find all records that match the given find options, and formats them as a list, using the format provided.neighbors
: To find the previous and after records of a matching record, based on the value of a particular field.threaded
: To finds a set of results, and return them in a hierarchy, based on the value of a field namedparent_id
.
Mastering these types is as easy as understanding the available find options all types deal with. In this chapter, we...