The point is that what you are trying to do, I and others do all the
time without any problems and without having to specify a field
whitelist array ... you are calling your data using a method which
sets the model data during retrieval, I don't know exactly why this is
creating your problem, but I
I see your point there in using find instead of read, but I still
think that a save operation should only take into account the passed
data (plus the special fields creatd and modified), looking at the api
and teh core code I can see there is a white list of fields to be
updated, you can specify th
Ahh, try using:
$this->User->find('first', array('conditions'=>array('User.id'=>1)));
Instead of:
$this->User->read(null, 1);
By using Model::read() you're setting the data array at the same time
as extracting your data.
Extract from http://book.cakephp.org/view/1029/read:
"read() is a method us
I have created a test function in the controller to illustrate it.
Remember that I am updating the user from the groups controller. The
relation is User belogs to Group, and Group hasMany User
function test(){
$this->Group->User->recursive=-1;
$user1=$this->Group->User->read(null,1
So you're re-checking UserA on every page load to compare if anything
hs changed, it would be more efficient to update the session after a
user's profile has been updated, then you only need to refer to the
session.
I am 99.9% certain this is not a bug as I update data in this way all
the time.
-
You are right that userA data is available in the session, and even
accessible via $this->Auth, but some userA data can be modified
outside of cake (or a cake task run via cron for instance) so I need
to read userA before saving userB.
>From my point of view a call to model->save where the data pa
Login should be an action conducted at least two page requests before
you edit UserB and as such why are you reading UserA's data when
saving UserB's edited data?
Once a user is authenticated their data is readily available in the
session, sounds like your doing an extra call and putting that data
It's part of the same query, no after/beforeSave running.
The model in question is the User model. These are my steps
1. Read the logged in user (Lets call it UserA)
2. Select another user from the user table to update (UserB).
3. Present a form with just a few fields that I need to update
4. Upd
Is the update of the enabled field happening as part of the same SQL
query or a separate one? Are you sure you have not got a callback
(beforeSave or afterSave) running which is doing this?
HTH, Paul
On Sep 25, 7:20 pm, dtemes wrote:
> More information, If i don't provide a value for fields tha
More information, If i don't provide a value for fields that have a
default value in the database, the fields are modified and they take
the database default value.
For instance I have a reset password action that takes data from a
form with just the user id and password. The data array only has i
I ahev to related models, group and user, and I have a form to update
user data from the groups controller, previously to the User->Save i
read some information from the current user, the code is something
like:
$this->Group->User->read->($this->Auth->user('id'));
.
.
.
$this->Group->User->Save($t
11 matches
Mail list logo