Page 405 of 211,273, showing 20 records out of 4,225,455 total, starting on record 8,081, ending on 8,100
# | Username | Text | |
---|---|---|---|
# | Aug 9th 2008, 21:30 | adj | well, i'm creating a behavior to sync fields in the model to fields in another db.table, any ideas on how to change the db and table for function in the (after|before)* methods? |
# | Aug 9th 2008, 21:30 | skua | with a behavior wich switch useDbConfig |
# | Aug 9th 2008, 21:31 | skua | hum |
# | Aug 9th 2008, 21:31 | skua | you sync when field are update or created ? |
# | Aug 9th 2008, 21:31 | skua | or in both |
# | Aug 9th 2008, 21:31 | adj | right |
# | Aug 9th 2008, 21:31 | adj | both |
# | Aug 9th 2008, 21:31 | adj | the other db is ldap |
# | Aug 9th 2008, 21:32 | adj | so when certain user fields are updated, i need them to push to ldap |
# | Aug 9th 2008, 21:32 | skua | ok so in your behavior create a function _sync() {} |
# | Aug 9th 2008, 21:32 | adj | exactly |
# | Aug 9th 2008, 21:32 | skua | where you copy $model->data in a vars, then use $useDbConfig = 'newdb'; |
# | Aug 9th 2008, 21:33 | skua | then a little $model->save( $thevarsofolddata ) |
# | Aug 9th 2008, 21:33 | adj | skua: ok. so the db switch needs to take place during the after|before hook, not the setup/cleanup |
# | Aug 9th 2008, 21:33 | skua | and you call you _sync() in afterSave |
# | Aug 9th 2008, 21:33 | skua | if you switch db in setup |
# | Aug 9th 2008, 21:34 | adj | it would also have to return the db to what it previously was at the end of _sync() though, or does it? |
# | Aug 9th 2008, 21:34 | skua | the first update/save will be in your new db |
# | Aug 9th 2008, 21:34 | skua | so first let cake making is stuff |
# | Aug 9th 2008, 21:34 | adj | skua: ok. got that. make since |