It's possible I am not doing this right at all.
I am initializing and storing into the session scope an object which contains details of the currently logged in user.
The CFC is called Provider, and when the user succesfully logs in I call:
session.Provider = New model.Provider().init(loginResult.ProviderID);
I have a method in the CFC called resetValues, which is to set the specified values to an empty string, but I can't work out how to save the entity once I have reset the values.
Here is the full CFC. I am attempting to save with entitySave( this );
, but not working. Any suggestions on how I should save (persist) this changes? Or do I need to completely rethink how I am going to change these values?
Many Thanks in advance.
component persistent="true" table="provider" {
property name="id" fieldtype="id" column="provider_id";
property name="title" ormtype="text";
property name="status" ormtype="integer";
property name="email" ormtype="text";
property name="ext_src" ormtype="text";
property name="ext_src_login1" ormtype="text";
property name="ext_src_login2" ormtype="text";
property name="ext_src_login3" ormtype="text";
property name="ext_src_login4" ormtype="text";
//property name="rooms" fieldtype="one-to-many" cfc="Room" fkcolumn="provider_id";
//init()
public function init(providerID="0"){
variables.providerID = arguments.providerID;
return this;
}
//get()
public function get(){
return entityLoadByPK("Provider",variables.providerID);
}
//resetValues()
public function resetValues(){
this.setExt_src_login1('');
this.setExt_src_login2('');
this.setExt_src_login3('');
this.setExt_src_login4('');
entitySave(this);
}
}
Im getting the following error: a different object with the same identifier value was already associated with the session