$Events = Model_Event::find(array('where' => $my_where, 'limit' => $limit, 'offset' => $offset));
$Count = Model_Event::count('id', false, $my_where);
$query = Model_Event::find()->where('soemthing', $something); $count = $query->count(); $events = $query->limit(15)->get();
// Observers to handle the timestamps, and also the detail serialisation. protected static $_observers = array( 'Orm\Observer_CreatedAt' => array( 'events' => array('before_insert'), 'mysql_timestamp' => false, ), 'Orm\Observer_UpdatedAt' => array( 'events' => array('before_save'), 'mysql_timestamp' => false, ), 'Orm\\Observer_Self' => array( 'before_save', 'after_load', ), ); // Before saving, move the detail_array property value to the detail // property, serializing it on the way. public function _event_before_save() { $this->detail = json_encode($this->detail_array); } // On loading an evenr, set the detail_array property to the decoded version // of the detail property. public function _event_after_load() { $this->detail_array = json_decode($this->detail, true); }
It looks like you're new here. If you want to get involved, click one of these buttons!