Ok, so I figured out how to generate a <SELECT> list using different
fields, other than the id, as the key => value pair.  But I still have
some issues.

* Is it possible to use multiple fields to make up the value of the
select box?  Such that it would come out looking something like

<option value='field1value'>field2value - field3value</option>

?

* I have 4 seperate tables.  sets, games_sets, game_pieces and
collections.  collections has a FK referencing game_pieces which has a
FK referencing games_sets which has a FK referencing sets.  So yay.
The following are the associated models follows by the associates
controllers (only the relevant parts; everything else is cut out):

class Collection extends AppModel {
        var $name = 'Collection';
        var $hasMany = array(
                        'GamePiece' =>
                                array('className' => 'GamePiece',
                                                'foreignKey' => 'game_piece_id' 
));
}

class CollectionsController extends AppController {
        var $name = 'Collections';
        var $uses = array('Collection', 'User', 'GamePiece');
}

class GamePiece extends AppModel {
        var $name = 'GamePiece';
        var $belongsTo = array(
                        'GamesSet' =>
                                array('className' => 'GamesSet',
                                                'foreignKey' => 'games_set_id',
                                                'conditions' => '',
                                                'fields' => '',
                                                'order' => '',
                                                'counterCache' => ''
                                ),

                        'Collection' =>
                                array('className' => 'Collection',
                                                'foreignKey' => 'id',
                                                'conditions' => '',
                                                'fields' => '',
                                                'order' => '',
                                                'counterCache' => ''
                                ));
}

class GamePiecesController extends AppController {
        var $name = 'GamePieces';
        var $uses = array('GamePiece', 'GamesSet', 'Collection', 'DeckPart',
'TradeGamePiece', 'GamePieceAttribute');
}

class GamesSet extends AppModel {
        var $name = 'GamesSet';
        var $belongsTo = array(
                        'Set' =>
                                array('className' => 'Set',
                                                'foreignKey' => 'set_id',
                                                'conditions' => '',
                                                'fields' => '',
                                                'order' => '',
                                                'counterCache' => ''
                                )

        );

        var $hasMany = array(
                        'GamePiece' =>
                                array('className' => 'GamePiece',
                                                'foreignKey' => 
'games_set_id'));

}

class GamesSetsController extends AppController {
        var $name = 'GamesSets';
        var $uses = array('GamesSet', 'Game', 'Set', 'GamePiece');
}

class Set extends AppModel {
        var $name = 'Set';
        var $hasMany = array(
                        'GamesSet' =>
                                array('className' => 'GamesSet',
                                                'foreignKey' => 'set_id'));

}

class SetsController extends AppController {
        var $name = 'Sets';
        var $uses = array('Set', 'GamesSet');
}

I'm trying to make it so that the collection controller can, going
through game_pieces, games_sets and finally sets, get the set name that
a game piece belongs to.  I'm trying to do something like:

$this->set('gamePieces',
$this->Collection->GamePiece->generateList(NULL,NULL,15,
'{n}.GamePiece.id', '{n}.Set.set_name ));

but that's not working.  Is something like this possible?  Or am I
going to have to generate the <SELECT> box manually?

thnx,
Christoph


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

Reply via email to