tegarkurniawan

portofolio

Oct 19th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php
  2. class Portofolio extends CActiveRecord{
  3. public static function model($className=__CLASS__){
  4. return parent::model($className);
  5. }
  6. public function tableName(){
  7. return 'Portofolio';
  8. }
  9. public function relations()
  10. {
  11. // NOTE: you may need to adjust the relation name and the related
  12. // class name for the relations automatically generated below.
  13.  
  14. return array(
  15. 'Pictures'=>array(self::HAS_ONE, 'Picture', 'portofolio_id'),
  16. 'Pictured'=>array(self::HAS_MANY,'Picture','portofolio_id' ,
  17.  
  18. ),
  19. 'user'=>array(self::BELONGS_TO,
  20. 'user',
  21. 'user_id'),
  22.  
  23. );
  24. }
  25. public function rules()
  26. {
  27. // NOTE: you should only define rules for those attributes that
  28. // will receive user inputs.
  29. return array(
  30.  
  31. array('name, description,status, user_id', 'required'),
  32. array('user_id', 'numerical', 'integerOnly'=>true),
  33. array('name', 'length', 'max'=>100),
  34. array('portofolio_id, status,name,description, user_id', 'safe', 'on'=>'search'),
  35.  
  36.  
  37.  
  38. );
  39. // The following rule is used by search().
  40. // @todo Please remove those attributes that should not be searched.
  41.  
  42. }
  43. public function attributeLabels()
  44. {
  45. return array(
  46. 'portofolio_id' => 'Portofolio',
  47. 'name' => 'Name',
  48. 'picture' => 'Picture',
  49. 'description' => 'Description',
  50. 'user_id' => 'User',
  51. 'id_kategori' => 'Id_kategori',
  52. );
  53. }
  54. }
  55.  
  56.  
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment