Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Portofolio extends CActiveRecord{
- public static function model($className=__CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return 'Portofolio';
- }
- public function relations()
- {
- // NOTE: you may need to adjust the relation name and the related
- // class name for the relations automatically generated below.
- return array(
- 'Pictures'=>array(self::HAS_ONE, 'Picture', 'portofolio_id'),
- 'Pictured'=>array(self::HAS_MANY,'Picture','portofolio_id' ,
- ),
- 'user'=>array(self::BELONGS_TO,
- 'user',
- 'user_id'),
- );
- }
- public function rules()
- {
- // NOTE: you should only define rules for those attributes that
- // will receive user inputs.
- return array(
- array('name, description,status, user_id', 'required'),
- array('user_id', 'numerical', 'integerOnly'=>true),
- array('name', 'length', 'max'=>100),
- array('portofolio_id, status,name,description, user_id', 'safe', 'on'=>'search'),
- );
- // The following rule is used by search().
- // @todo Please remove those attributes that should not be searched.
- }
- public function attributeLabels()
- {
- return array(
- 'portofolio_id' => 'Portofolio',
- 'name' => 'Name',
- 'picture' => 'Picture',
- 'description' => 'Description',
- 'user_id' => 'User',
- 'id_kategori' => 'Id_kategori',
- );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment