I've been trying this and it's not working, but its not failing either.

Here's the rub: I need to access the value of character.name that
corresponds to primary_character_id for the member that corresponds to
the current character.

So let's say William Shattner is a member, and Captain Kirk is one of
his characters, along with T.J. Hooker. And we're looking at a listing
of many famous characters and we see a row for T.J Hooker and would
like to see a column in that row that shows that Captain Kirk is
actually Shattner's primary character.

I've tried boosting my recursion value, and tried using something like:

$this->set('chars',
$this->Character->findAll(null,null,null,null,$page,3));

foreach $chars as $char
{
 echo  $char['Member']['PrimaryCharacter']['name'];
}

I set my Member model to include:

var $hasMany = array('Character' => array('className' => 'Member'));
var $hasOne = array('PrimaryCharacter' => array('className' =>
'Member', 'foreignKey' => 'primary_member_id'));

Pretty much exactly as you have above, and then I added the following
to my Character model with:

        var $belongsTo = array('Member','Genre');
        var $hasMany = array('PrimaryCharacter' => array('className' =>
'Member'));

As I mentioned, this generates no errors when I try to use echo
$char['Member']['PrimaryCharacter']['name'];

I've even tried doing print_r($char['Member']['PrimaryCharacter']);

Nothing comes up.

I've also tried with and without the matching delcaration in the
Character model.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to