# |
Aug 7th 2008, 04:37 |
alkemann |
Users HABTM Groups => Model UsersGroup |
# |
Aug 7th 2008, 04:36 |
alkemann |
in fact cake makes a model for all habtm relationships |
# |
Aug 7th 2008, 04:36 |
alkemann |
JeffEmbracedDC: u can make the with model in same way as other models |
# |
Aug 7th 2008, 04:36 |
JeffEmbracedDC |
alkemann: works great in my opinion.. only downside I've come across so far.. is.. I'm not sure how you add beforeSave/afterSave/whatever functions to the faux model.. or if it's possible at all. |
# |
Aug 7th 2008, 04:36 |
stevieboy |
pgcd: it's always good to have an open eye. but mostly you can check the manual for the helpers provided. if you arent lucky there, try it the normal way |
# |
Aug 7th 2008, 04:36 |
pgcd |
as somebody said, sometime it's quicker to just reinvent the wheel =) |
# |
Aug 7th 2008, 04:35 |
pgcd |
stevieboy: that is good advice - it might save me a lot of time down the road if i just *do* things instead of perusing manual api and google to see if there's something else that does it |
# |
Aug 7th 2008, 04:35 |
alkemann |
Martz: JeffEmbracedDC when using a with I have been forced to add an id field and put it as primary key, but that has worked well |
# |
Aug 7th 2008, 04:35 |
JeffEmbracedDC |
Martz: Gotchya |
# |
Aug 7th 2008, 04:35 |
Martz |
JeffEmbracedDC: im aware it exists, I played with it, but I dont use it |
# |
Aug 7th 2008, 04:34 |
Martz |
JeffEmbracedDC: the downside, which someone pointed out to me, is that mysql isnt able to "ensure integrity" of not having the same 2 foreign keys, since they are not primary keys like in a HABTM join table. However that is solveable with validaiton and checking at the PHP level |
# |
Aug 7th 2008, 04:34 |
JeffEmbracedDC |
Martz: well...... are you familiar with 'with' associations? which allow for added meta data and faux model access of the join table? |
# |
Aug 7th 2008, 04:33 |
Martz |
JeffEmbracedDC: yeah. I tend to make my schema now with a 3rd real model instead of a join table, so that I can add meta data, easily define complex conditions etc |
# |
Aug 7th 2008, 04:33 |
pgcd |
speed and memory usage of foreach don't worry me in this case, seeing as it's gonna be 3/4 records at most for every loop |
# |
Aug 7th 2008, 04:33 |
stevieboy |
pgcd: cake helps with data retrival and so on. in the view it's mostly normal php with the vars |
# |
Aug 7th 2008, 04:32 |
pgcd |
stevieboy: =) i'll use it... honestly, it's just that i'm so new to cakephp that I always expect there's a "neater" way of doing everything |
# |
Aug 7th 2008, 04:32 |
JeffEmbracedDC |
Martz: hah really? hmm |
# |
Aug 7th 2008, 04:31 |
Martz |
JeffEmbracedDC: i ran away from HABTM and any complex queries I'd need for them a long time ago ;) Life is too short for HABTM! ;) |
# |
Aug 7th 2008, 04:31 |
stevieboy |
pgcd: i meant you are wrong. foreach is usefull and the right approach for that |
# |
Aug 7th 2008, 04:31 |
Martz |
poluta1: and if you try and implement it and get any errors, please bin your code of what you have (app controller, app model, and any models using it) |
# |
Aug 7th 2008, 04:31 |
JeffEmbracedDC |
hey martz ... you familiar with 'with' associations for join tables? |
# |
Aug 7th 2008, 04:31 |
pgcd |
stevieboy: we belong to the church of "Everything should be on one line", probably =) |
# |
Aug 7th 2008, 04:31 |
stevieboy |
pgcd: that's just wrong,imho |
# |
Aug 7th 2008, 04:30 |
Martz |
poluta1: something like this - also read the comments in top. = 'foo'; would be the logic to grab whatever you want from Session::read() http://bin.cakephp.org/view/1267003022 |
# |
Aug 7th 2008, 04:30 |
pgcd |
stevieboy: somehow i feel i shouldn't have it in my views... |
# |
Aug 7th 2008, 04:30 |
JeffEmbracedDC |
foreach is okay but it's usually not as fast as other loop methods . |
# |
Aug 7th 2008, 04:30 |
stevieboy |
pgcd: lol, i cant see why. it's like the one with the guy who says "continue" is evil in loops |
# |
Aug 7th 2008, 04:29 |
pgcd |
stevieboy: yep, i admit to being a bit wary of foreach... |
# |
Aug 7th 2008, 04:29 |
pgcd |
stevieboy: well, I could certainly extract both the ids and the names, but i fail to see how combining the arrays would help... |
# |
Aug 7th 2008, 04:29 |
stevieboy |
pgcd: do you see foreach as sth evil? you keep avoiding it |
# |
Aug 7th 2008, 04:29 |
poluta1 |
Martz: ok thank Martz.. i'am waiting :) |
# |
Aug 7th 2008, 04:28 |
JeffEmbracedDC |
when using 'With' associations - is it possible to set up afterSave functions? |
# |
Aug 7th 2008, 04:28 |
pgcd |
htmlhelper->link doesn't work with arrays, does it? |
# |
Aug 7th 2008, 04:28 |
stevieboy |
pgcd: maybe array_combine helps? |
# |
Aug 7th 2008, 04:27 |
pgcd |
Ok, so set::extract works great to make lists - what I can't seem to do without a foreach is having the list turned into a list of links, instead of strings... |
# |
Aug 7th 2008, 04:27 |
thestaff |
what do you use ? |
# |
Aug 7th 2008, 04:27 |
poluta1 |
i can't modify AppModel model class attributes |
# |
Aug 7th 2008, 04:26 |
batcoder-7 |
whats the max you guys ever got done in 5 hours ? |
# |
Aug 7th 2008, 04:26 |
stevieboy |
*it |
# |
Aug 7th 2008, 04:26 |
stevieboy |
i dont use the thickbox-thingy, so i cant really test is |
# |
Aug 7th 2008, 04:25 |
thestaff |
stevieboy, what should I do ? |