> I believe that the point of the helper functions is to keep things > database-agnostic, and building in exceptions for a specific database > should be kept to a minimum.
I'm not talking about creating helpers or helper functions. Just using a DB view's model for things like findAll(), generateList(), etc. Consider the following: Table: games Fields: id, game_name Table: sets Fields: id, set_name Table: game_sets Fields: id, set_id, game_id Table: game_pieces Table: id, game_set_id, piece_name Using just the game_pieces model, if I use findAll(), generateList(), et. al., I get only the game_set_id and would have to look elsewhere (in the array returned by, say, findAll()) to get the set name or even the game name. Not in and of itself a bad thing but if you have thousands and thousands of game pieces, each getting returned with the related game_sets, games, sets, that's a massively huge array that you'll be getting back. Now, lets consider the following view (which will have it's own Cake model) CREATE VIEW game_pieces_view AS SELECT game_pieces.id, game_pieces.piece_name, games.game_name, sets.set_name FROM game_pieces INNER JOIN game_sets ON games_sets.id = game_pieces.game_set_id INNER JOIN sets ON sets.id = game_sets.set_id INNER JOIN games ON games.id = game_sets.game_id so now I can do $this->GamePiecesView->findAll() or $this->GamePiecesView->generateList() and have easy access to access to just the data I need. I'll be doing all of this in the game_pieces_controller in, for example, the index action method. This is a departure since the controller wouldn't be using the corresponding model but instead a related model (ie, GamePiecesView model and not the GamePieces model). I'd still be using the GamePieces model for other things (for example saving the data from add/edit) but for general wholesale listing of data (for example, the output from the index action), I'd be using the GamePiecesView model. Because of that departure and because I'm so new to MVC in general, I'm not sure if it's good practice. This is the reason for my original question. 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 [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?hl=en -~----------~----~----~----~------~----~------~--~---
