tegarkurniawan

code

Oct 15th, 2014
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. punya table seperti ini :
  2. portofolio:
  3. portofolio_id,name,description,status
  4. picture:
  5. id_pic_portofolio,name,picture,status,description,portofolio_id
  6. saya membuat di masing " model seperti ini
  7. class Picture extends CActiveRecord{
  8. public function relations()
  9. {
  10.  
  11. return array(
  12. 'Portofolio'=>array(self::BELONGS_TO,
  13. 'Portofolio',
  14. 'Portofolio_id'),
  15. );
  16. }
  17. }
  18. ---------------------------------------
  19. class Portofolio extends CActiveRecord{
  20. {
  21.  
  22. return array(
  23. 'Picture'=>array(self::BELONGS_TO,
  24. 'Picture',
  25. 'Portofolio_id'),
  26. );
  27. }
  28. }
  29. --------------------------------
  30. saya ingin memanggil field picture di table picture dengan id_pic_portofolio terkecil jadi masing" portofolio munculkan 1 picture dari table picture bagaimana cara'y ?
  31. saya sudah coba tapi salah--
  32. $model->Picture->picture; // tapi tidak keluar
Advertisement
Add Comment
Please, Sign In to add comment