Alright so I’ve tried this in the Live Chat and fried the brains of a few people in there lol… hoping someone here might be able to help me. My problem is:
I have a page with a search which goes through a table finding serial keys, then partialRenders the results box with the new information:
Controller:
public function actionUpdateAjax() {
$searchParam = $_POST['searchInput'];
$criteria = new CDbCriteria;
$criteria->condition = 'serial=:serial';
$criteria->params = array(':serial' => $searchParam);
$this->renderPartial('partials/inStock/acc01', array(
'Modems' => Modems::model()->findAll($criteria)));
}
This works fine when I search for values.
My problem is that when I use the view code:
foreach($Modems AS $Modem)
{
echo "<a class='asset_frame' href='" .CHtml::ajax( array('id'=>'searchInput', 'method'=>'POST')). "'>";
echo "Modem ID: ".
$Modem->modem_id.
"<br>".
$Modem->asset_id.
"<br>".$Modem->asset->displayName;
echo "</a>";
}
… the partial render won’t render. However, if I comment out the $Modem->asset->displayName I get the partialRender working.
The relation for the Modem model is:
public function relations()
{
return array(
'asset' => array(self::BELONGS_TO, 'Assets', 'asset_id'),
);
Can anyone help? This is really holding me up
P.S as a side note, I have two other relations set up in two other models and can access them just fine when used in the same manner. If it matters, I override getCDbConnection in all three models as the Modems model uses a seperate DB and relates into the same one as the first two.