# |
Aug 10th 2008, 04:43 |
pgcd |
Neters: sounds like a good investment! Gimme your paypal id! |
# |
Aug 10th 2008, 04:42 |
NetersLandreau |
pgcd: if you believe everything you read, i have a few acres of land in south florida, just west of me, that i can sell you ;) |
# |
Aug 10th 2008, 04:41 |
Martz |
darki: link them "normally" in cake and generate your own reference id |
# |
Aug 10th 2008, 04:41 |
pgcd |
I guess it's because $this->model->name might not be set as a var with PHP5, maybe? |
# |
Aug 10th 2008, 04:41 |
Martz |
darki: the point is - stop trying to mess around with real foreign keys. Make a seperate field for reference/searching made up of the account primary key - and then a counter if you like. Whatever, but dont try and engineer/manage the pk/fk yourself. Just going to end up in the mess |
# |
Aug 10th 2008, 04:40 |
pgcd |
Neters: are you sure? I think I found that in the API... |
# |
Aug 10th 2008, 04:40 |
darki |
mh must think about that, because 48951 can be the last possible booking_id for this account and then 49052 ist not the nex but 49001 (if you understand what i mean) |
# |
Aug 10th 2008, 04:39 |
NetersLandreau |
yes pgcd, i think [$this->model()] should be [{$this->model->name}] |
# |
Aug 10th 2008, 04:39 |
pgcd |
Martz =) |
# |
Aug 10th 2008, 04:38 |
Martz |
pgcd: great minds ;P |
# |
Aug 10th 2008, 04:38 |
pgcd |
Neters: where exactly? in the extendedform thingy? |
# |
Aug 10th 2008, 04:38 |
Martz |
darki: but booking_id should be the foreign key of Booking, which has a primary key right? So why not have a seperate field called "reference" and in your beforeSave() or similar, concat the primary key of the account and the foreign key of the booking ID |
# |
Aug 10th 2008, 04:38 |
pgcd |
darki: what about a booking_id *and* an auto_increment? then you concat the two and you're set? |
# |
Aug 10th 2008, 04:37 |
darki |
so if ha make a booking on account 490 i have to find 49003 as next possible booking id |
# |
Aug 10th 2008, 04:37 |
darki |
no booking_id is not the pk - i have differents accounts: 489 490 491 etc. an every account can have booking ids (48901, 49001, 49002 ...) |
# |
Aug 10th 2008, 04:36 |
Martz |
darki: no there is more than that, otherwise you would use auto increment? |
# |
Aug 10th 2008, 04:36 |
darki |
just want to have the next possible number - doesnt matter if it is a string or an int |
# |
Aug 10th 2008, 04:35 |
Martz |
darki: what are you trying to achieve? Whats the bigger picture... |
# |
Aug 10th 2008, 04:35 |
NetersLandreau |
pgcd: i think you should be using [{$this->model->name}], shouldn't you? |
# |
Aug 10th 2008, 04:35 |
darki |
am i right? |
# |
Aug 10th 2008, 04:35 |
darki |
but if it is a string i cant add 1 - so if i find 48904 as last booking_id i cann use '48904'+1 to geht '48905' - i have to cast first |
# |
Aug 10th 2008, 04:34 |
Martz |
could try LIKE 489% |
# |
Aug 10th 2008, 04:34 |
darki |
and i only have to find a way using wildcards ;) |
# |
Aug 10th 2008, 04:33 |
pgcd |
that is very true =) |
# |
Aug 10th 2008, 04:33 |
darki |
;) |
# |
Aug 10th 2008, 04:33 |
darki |
mh okay, than i can use wildcards instead of math condistion |
# |
Aug 10th 2008, 04:33 |
Martz |
pgcd: simplest != bestest ;) |
# |
Aug 10th 2008, 04:33 |
pgcd |
i meant darki, sorry |
# |
Aug 10th 2008, 04:32 |
pgcd |
martz: I think the simplest way would be for you to change that INT field into a string |
# |
Aug 10th 2008, 04:32 |
darki |
i need to get the next possible booking id - the first 3 numbers are set, only the last 2 numbers can change - so booking id is between 48900 and 48999 |
# |
Aug 10th 2008, 04:32 |
pgcd |
Neters: here it is - you'll see it's unlikely it has much of an impact... http://bin.cakephp.org/view/1537795777 |
# |
Aug 10th 2008, 04:31 |
Martz |
darki: but thats such a nasty thing to be doing in your app right? for a booking_id ? |
# |
Aug 10th 2008, 04:31 |
Martz |
or something along those lines? |
# |
Aug 10th 2008, 04:30 |
Martz |
where MAX(field) and field > 489000 AND < 489999 |
# |
Aug 10th 2008, 04:30 |
darki |
martz: guess you are right, i have to overthink how to find the biggest int starting with 489 for example |
# |
Aug 10th 2008, 04:29 |
NetersLandreau |
pgcd: you are close but there is something in the way you are redefining $form that is not exactly right |
# |
Aug 10th 2008, 04:28 |
primeminister |
is it nate? |
# |
Aug 10th 2008, 04:28 |
primeminister |
who is responsible for http://cake.insertdesignhere.com ? |
# |
Aug 10th 2008, 04:28 |
Martz |
something isnt right if you are doing an int with wildcard? Shouldnt it be > or < or = |
# |
Aug 10th 2008, 04:28 |
primeminister |
hi all |
# |
Aug 10th 2008, 04:27 |
darki |
i'll try |