I think it depends whether you store this value in the database or not. If you do, the right thing is to create a table and then accessing it by a model. For a very good reason, in big projects you don't want to lose time thinking "is it a table or a array within a controller? in which controller is it?".
Also, if this value is used in the database, later you may want to write a single query to retrieve this data, and run this query on the console (or a backup script, e.g.) and suddenly you realized that that tied you to cakephp. If you think that's the best solution (to keep this data as an array), the ideal solution (in my mind) would be to have a Model which access this array instead of a database table. If you only need it for drop boxes, maybe this: app/models/gender.php class Gender // extends nothing { var $data = array( 'M' => 'Male', 'F' => 'Female' ); function find($type,$opt=null) { if ( $type='list' ) return $data; throw new exception(" find('$type') in bogus model isn't supported - maybe it's time to use a real table." ); } } I know, it's ugly, but what's the upside of all this coding? All data in accessible by models, and you didn't wrote a lot of database tables that will never change. I would love proper support of "virtual" models that access data on a CSV, static array, etc. dfcp On 18 maio, 15:46, Jason Mitchell <jason.a.mitch...@gmail.com> wrote: > I have in a controller an array containing data used on the view to populate > a drop down. I put it on the controller, so the array could be used by > multiple views associated with that controller (create, edit). Additionally, > it means that if I do ever have to change it, I just have to change it once > (yup, lazy). > > Because the data is relatively static, and is used in only isolated > instances, it didn't seem to be worth the effort of creating a model for > that data, and establishing a relationship between models. And, putting it > on the controller, worked. > > Admittedly, I'm new to MVC, but this really doesn't seem to jive definition. > Am I doing something wrong? If so, how would one but this on the model, > short of some sort of association with another model? > > -- > J. Mitchell -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php