Skip to content

Instantly share code, notes, and snippets.

@yjeroen
yjeroen / yiirm
Created November 28, 2011 09:56
Yii get attributes of related models
/**
* Returns the attribute of the related HAS_MANY models as a string
* @param object $model->relation
* @param string attribute you want to return
* @param string $break The way you want to seperate the values [comma|enter|array]
* array returns a CHtml::listData array
* @return mixed string or array
*/
public function getRelValues($relatedModels, $attribute, $break='comma')
{
MODEL
public function getActieveKanalen($id)
{
$var = $this->kanalen( array("condition"=>"id=".$id) );
$var = array_pop($var);
if(isset($var))
return "Yes";
else
return "No";