FuelPHP Bin
My Model
<?php /** * Airport model * * @package app * @extends Orm\Model */ class Model_Airport extends Orm\Model { protected static $_table_name = 'airports'; protected static $_primary_key = array('id'); protected static $_properties = array('id', 'ident', 'tz_ident', 'name', 'location'); protected static $_conditions = array('limit' => 1); public static function fetch($ident) { if($ident) { $airport = static::find()->where('ident', $ident)->get_one(); if($airport) { return $airport; } else { Log::info($ident . " - Cached airport data not found ... retrieving from FlightXML"); // Fetch airport data from FlightXML } } else { Log::error("Failed to retrieve airport data - no `ident` specified"); } } }