Managing a history of changes

2010-05-18 Thread paws_galuten
Hi, Please excuse the long post... I tried to give a concise question, but also I felt the need to give an example and explain... I need to store a history of database changes (i.e. copies of all of the fields [with their same ids] grouped by a publish date), and I'm having trouble designing the

Re: One Parent Model for All Other Models?

2010-05-11 Thread paws_galuten
t_publishing of the new schedule minus 1 > day), number of employees?, or any accumulated data you need in the schedule > level. > > schedules rows: > id, batch_id,. > > You can use [year]_[number of week (1-52)] as a batch number for human > readability. > > The session

One Parent Model for All Other Models?

2010-05-10 Thread paws_galuten
Hi, My question is below, but first some info about the situation I'm in: I am taking an app that I wrote years ago for scheduling people in different areas of work at our Center, and re-writing it in cakePHP. In the mean time, I'm doing all sorts of things better than ever before ;) Among many

Re: Multiple Undo/Redo!!

2010-05-07 Thread paws_galuten
This code has now been packaged as a plugin! http://github.com/shantamg/multiple_undo Horray! On May 6, 2:15 pm, paws_galuten wrote: > I have been working on this code and would still like feedback. > > I have moved the code here: > > http://gist.github.com/391886 > >

Re: Multiple Undo/Redo!!

2010-05-06 Thread paws_galuten
I have been working on this code and would still like feedback. I have moved the code here: http://gist.github.com/391886 I am a cake n00b so please help me to see how this could be better! Thanks, Jason On May 5, 9:05 am, paws_galuten wrote: > yes, that makes sense too. it wastes more sp

Re: Multiple Undo/Redo!!

2010-05-05 Thread paws_galuten
and then everytime the model was > saved, re-save the entire model and increment the version number . > > Mike > > On May 2, 8:53 pm,paws_galuten wrote: > > > > > > > Hey everyone. I've written some code that I'd love to get some > > feedback on.

Multiple Undo/Redo!!

2010-05-02 Thread paws_galuten
Hey everyone. I've written some code that I'd love to get some feedback on. I have posted an "article" here: http://www.galuten.com/jason/Undo.rtf It's a bit involved but I think it could be very useful if developed further! Thanks for your attention... Jason Check out the new CakePHP Questions

Re: Good database design -- multiple databases in one app??

2010-04-25 Thread paws_galuten
As I think about it, putting comma-delimited data in one field is pretty yucky i suppose there could be an extra table called undo_fields which has a foreign key to the undo table. On Apr 25, 3:20 am, Zaky Katalan-Ezra wrote: > About the auto increment I meant the mysql column property AI. >

Re: Good database design -- multiple databases in one app??

2010-04-25 Thread paws_galuten
Thank you, Zaky, for your ideas. I have to say, I was thinking pretty much the same way before I read you post--Using beforeSave to create an sql statement which would be stored in an undo table which would get the data back to the way it was. The way you laid it out is very clever, and it may be t

Re: Good database design -- multiple databases in one app??

2010-04-24 Thread paws_galuten
On Apr 24, 2:17 pm, ZAky wrote: > You can easily say it's actually two application there for two > databases its fine. It really is one application. In fact, it uses basically the same code for the two databases. The staging area simply has more features, and then when it gets published, the ch

Good database design -- multiple databases in one app??

2010-04-24 Thread paws_galuten
Thanks to everyone for all of their helo so far. I have been learning so much! I am in the process of rebuilding an application that I wrote years ago, but this time using cake! So far it is looking very promising and I think the whole thing will be so much cleaner! One thing a colleague of mine s

Sometimes ACL is just too much

2010-04-23 Thread paws_galuten
I wrestled with ACL for a while, and finally decided that might be too much for what I'm doing. I only really need a few types of users and in that case it is simple enough just to have a field in the users table that specifies the type (or is a foreign key to the groups table, for example). This

Re: ACL and Auth -- Who's logged in and what group are they in?

2010-04-23 Thread paws_galuten
million people have asked this so thanks for your patience and please direct me to any older posts that may have answered this. I just don't know what to search for! Thanks, Jason On Apr 23, 3:58 am, cricket wrote: > On Apr 22, 7:02 pm, paws_galuten wrote: > > > > > >

ACL and Auth -- Who's logged in and what group are they in?

2010-04-22 Thread paws_galuten
It is very difficult to understand, but I'm finally getting ACL and Auth working in my app. I have a User model and a Group model (pretty much copied from the Cookbook). I have figured out a few things but there are still things that are not clear. Here's what I know: In order to allow public acce

Re: Avoiding Redundant Data With Recursive

2010-04-12 Thread paws_galuten
> you have to use the current Shift.area_id to look up the Area.name > from a general array of Areas. right. so i'm thinking just to get only the areas that will be needed by the shifts, and when i get to a shift, reference the area array. i'm just wondering if that's worth it... probably not, h

Re: Avoiding Redundant Data With Recursive

2010-04-12 Thread paws_galuten
I appreciate the ideas, but using distinct or limit is not going to change the situation. What is happening is the "SELECT (...) FROM areas (...)" statement is being called multiple times (once for every shift) and many of those times it says "WHERE area.id = 1" because many shifts have area_id = 1

Re: Avoiding Redundant Data With Recursive

2010-04-12 Thread paws_galuten
> > I am using containables for it already. The point for me is that if > > two shifts come from the same area, that same area info will be listed > > for each shift. Somehow I'd like to get that area info only once... > > Can you post your find/contain code please. > $this->Person->id = $id; $th

Re: Avoiding Redundant Data With Recursive

2010-04-11 Thread paws_galuten
> One thing you could do is *not* contain Area and, instead, run a > find() on that separately. In your view, when listing the shifts, get > the Area.name from the Shift.area_id. Something like: > > $this->set('data', $this->Person->find(..., 'contain' => > array('Shift') ... > > $this->set('areas'

Re: Avoiding Redundant Data With Recursive

2010-04-11 Thread paws_galuten
I am using containables for it already. The point for me is that if two shifts come from the same area, that same area info will be listed for each shift. Somehow I'd like to get that area info only once... Right now it looks something like this: Array ( [Person] => Array (

Avoiding Redundant Data With Recursive

2010-04-11 Thread paws_galuten
Person hasMany Shift and Shift belongsTo Area. When I do a find() on Person, I get the shifts, and also the area for each shift. That's cool, but many of the shifts are from the same area and in that case I have the same area data listed many times. Is this not a big deal, or is there some other w

Re: Manipulating Data Based on Non Related Model Data

2010-04-10 Thread paws_galuten
view part. > > Jeremy Burns > jeremybu...@me.com > > On 10 Apr 2010, at 05:33, paws_galuten wrote: > > > > > Ah, a helper... ok. I'll research that. Where do helpers fit into the > > MVC pattern? > > What do you mean by "presentation layer?&qu

Re: Manipulating Data Based on Non Related Model Data

2010-04-09 Thread paws_galuten
hen the display logic probably belongs in a helper? > > Jeremy Burns > jeremybu...@me.com > > On 10 Apr 2010, at 02:00, paws_galuten wrote: > > > > > I am learning that data manipulation needs to be done in the model. > > Fat Model, thin controller. Ok, so I'm

Manipulating Data Based on Non Related Model Data

2010-04-09 Thread paws_galuten
I am learning that data manipulation needs to be done in the model. Fat Model, thin controller. Ok, so I'm trying to wrap my mind around something. Here's my example: Let's assume these tables: people (id, name) events (id, name, day, time) events_people (event_id, person_id) So, people HABTM ev

Re: Retrieving objects from the DB instead of arrays

2010-03-30 Thread paws_galuten
erson->getAge(), you might have > > $formatter->getAge($person['Person']['birthday']) where "$formatter" > > is FormatterHelper and getAge() is a function that takes a date and > > converts it to an age. For helpers: > > >http://book.ca

Retrieving objects from the DB instead of arrays

2010-03-30 Thread paws_galuten
I'm new to cakePHP and it seems like the only way to retrieve data from the data source is as an array. I'm finding that I am using a lot of code in my controller to prepare the arrays for display in the view, when I would rather be able to send an object to the view and get data from that object.

Re: Setting arrays for a complicated HABTM relationship

2010-03-21 Thread paws_galuten
Ha! I figured it out... I can just change this: $this->set('moods', Set::combine($moods,'{n}.Moods.woman_id','{n}.Moods.mood','{n}.Moods.time_i d')); to this: $this->set('moods', Set::combine($moods,'{n}.Moods.woman_id','{n}.Moods','{n}.Moods.time_i d')); By changing '{n}.Moods.mood' to just '

Re: Setting arrays for a complicated HABTM relationship

2010-03-21 Thread paws_galuten
Thanks for the help. Yes, Set::combine did the trick for me, but there's a complication that leads me to another question. I did: $moods = $this->Moods->find('all'); $this->set('moods', Set::combine($moods,'{n}.Moods.woman_id','{n}.Moods.mood','{n}.Moods.time_id')); That way in the view, I get an

Setting arrays for a complicated HABTM relationship

2010-03-20 Thread paws_galuten
Hello experts! Let's say there are many women in my life (ha!) and depending upon the time, they might have different moods. This cannot be a simple HABTM relationship because I want a value associated with the join table, so I have defined the models like this: Woman hasMany Mood Time hasMany Mo