<?php use ORM\ORM_Model; /* * This class uses all the defaults for ORM_Model * * - Table will be cars * - Primary key is id * - It is in the database defined under the database group in the Configuration */ class Car extends ORM_Model { } // Find a single car $carTen = Car::Find(10); // Find the first red car $redCar = Car::FindByColour('red'); // Find all the blue cars $blueCars = Car::FindAllByColour('blue');
<?php // Find all red cars $cars = Car::FindAllByColour('red'); // Find all cars with more than 3 doors $cars = Car::FindAllByDoors(3, '>'); // Find all cars with more than 3 doors and include the owners $cars = Car::FindAllByDoors(3, '>', '\\ORM\\Mock\\Owner'); // We could now create an array of owners $owners = $cars->map('Owner');