janely
(Sony Suwanamiharja)
October 10, 2011, 8:50am
1
Ada kesulitan nih saya,
Saya punya relasi :
item
rItemPrice = array(self::HAS_MANY,‘ItemPrice’,‘item_id’),
item_price
rItemPrice = array(self::BELONGS_TO, ‘Item’,‘item_id’),
search()
$criteria->with=‘rItemPrice’;
$criteria->compare(‘rItemPrice.price’, $this->price, true);
kok aneh yah, left outer joinnya gak jalan
tolong dunk
thanks
aqge
(Programmer Riau)
October 10, 2011, 4:10pm
2
sepertinya begini tuh gan…
$criteria->with='rItemPrice';
$criteria->compare('rItemPrice.price', $this->rItemPrice ->price, true);
janely
(Sony Suwanamiharja)
October 11, 2011, 4:31am
3
aqge:
sepertinya begini tuh gan…
$criteria->with='rItemPrice';
$criteria->compare('rItemPrice.price', $this->rItemPrice ->price, true);
Masih bermasalah … seperti tidak di compare … datanya sama saja
salah dimana yah
aqge
(Programmer Riau)
October 11, 2011, 6:19am
4
gan sudah coba di debug sbelum dicompare
var_dump( $this->atributes );
//atau
var_dump($this->itemPrice->attributes);
//ingat itemprice itu relasi has many, jadi harus direkrusi
ada lagi trik ampuh untuk debug, aktifkan mysql query log, dan agan bisa chek langsung disana apapkah query yang dihasilkan sudah seperti yg agan harapkan…
trims.
yiippy
(Smartgdi)
October 27, 2011, 8:48am
5
Masalahnya mirip dengan punyaku gan. Jadi saya ingin merelasikan tabel user dengan tabel pengalaman_kerja di mana user HAS_MANY pengalaman_kerja dan pengalaman_kerja BELONGS_TO user.
//model User.php
'pengalaman_kerja' => array(self::HAS_MANY, 'PengalamanKerja', 'id_user'),
//model PengalamanKerja.php
'user' => array(self::BELONGS_TO, 'User', 'id_user'),
// function search()
$criteria->with = array(
'pengalaman_kerja' => array(
'alias' => 'pk'
),
);
$criteria->compare('pk.posisi', $this->posisi, true);
Kalau kesimpulanku sementara mungkin karena men-joinkan relasi BELONGS_TO dengan HAS_MANY. mungkin agan2 yg punya solusinya
Angela88
(Angela Arrie)
October 27, 2011, 10:20am
6
Janely:
Ada kesulitan nih saya,
Saya punya relasi :
item
rItemPrice = array(self::HAS_MANY,‘ItemPrice’,‘item_id’),
item_price
rItemPrice = array(self::BELONGS_TO, ‘Item’,‘item_id’),
search()
$criteria->with=‘rItemPrice’;
$criteria->compare(‘rItemPrice.price’, $this->price, true);
kok aneh yah, left outer joinnya gak jalan
tolong dunk
thanks
$criteria->with='rItemPrice';
$criteria->compare('rItemPrice.price', $this->id_rItemPrice, true);
id_rItemPrice nya di sesuain ma primary key table rItemPrice