I read a bunch, still confused (more than usual).
I want to display a fk value in a simple view file. This is confusing the **** out of me.
DB:
Projects can have many comments. Comments are entered by one person.
model - comments:
public function relations()
{
'deliverable' => array(self::BELONGS_TO, 'Deliverable', 'deliverable_id'),
'issue' => array(self::BELONGS_TO, 'Issue', 'issue_id'),
'person' => array(self::BELONGS_TO, 'Person', 'person_id'), <---------
How can i retrieve the fk value from person in a view file. I have tried many different solutions, and still getting errors.
I can do it in a grid, list, etc… But can’t seem to understand why i can’t just do it in a loop.
Here is my last attempt in my view file.
<?php echo (CHtml::encode($comment->person->fullName)); ?>
on
<?php echo date('F j, Y \, h:i a',strtotime($comment->date_created)); ?>
<br><br>
returns an error. BTW - person is the relation and fullName is a function within the person model.
Please explain or point me in the right direction.
Signed improving, but still going nuts.