Skip to content

Instantly share code, notes, and snippets.

@ariews
Created March 13, 2013 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariews/5153808 to your computer and use it in GitHub Desktop.
Save ariews/5153808 to your computer and use it in GitHub Desktop.
<?php
class Model_Category extend Jelly_Model
{
public static function initialize(Jelly_Meta $meta)
{
/**
* defaultnya sih categories, tapi kalo kita punya table berbeda,
* pake method table() buat definisi nama table
*/
$meta->table('kategori')
->fields(array(
'id' => new Field_Primary,
'name' => new Field_String,
'slug' => new Field_Slug,
));
}
public function save($key = null)
{
if ( ! $this->loaded() )
$this->slug = $this->name;
return parent::save($key);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment