Created
March 13, 2013 16:28
-
-
Save ariews/5153808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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