We will start by implementing the menu page. The initial functionality of the menu page will be to retrieve a list of all the milkshakes in alphabetical order.
To retrieve a result set, we have to initialize a Criteria
object and customize it. This object then represents an SQL query. As our custom classes extend the base class, we use one of a number of methods of the parent. Passing the Criteria
object to the method results in the query that is performed on our database. The Criteria
object can handle both simple and relatively complicated queries. However, as a rule it is a good practice to customize the Criteria
object to only retrieve what you want. This will be covered in detail in Chapter 9,Optimizing for performance.
Opening the lib/model/MilkShakePeer.php
file reveals that there are no methods. As this is a custom class, it is up to us to add our business logic. Here we need to create a static method to retrieve data about all...