Fuel\Core\FuelException [ Error ]: Primary key cannot be changed.
PKGPATH/orm/classes/model.php @ line 892
887 throw new FrozenObject('No changes allowed.');
888 }
889
890 if (in_array($property, static::primary_key()) and $this->{$property} !== null)
891 {
892 throw new \FuelException('Primary key cannot be changed.');
893 }
894 if (array_key_exists($property, static::properties()))
895 {
896 $this->_data[$property] = $value;
897 }
Backtrace
PKGPATH/orm/classes/model.php @ line 782
PKGPATH/orm/classes/hasone.php @ line 216
PKGPATH/orm/classes/model.php @ line 1152
APPPATH/classes/controller/users.php @ line 140
COREPATH/classes/controller/rest.php @ line 117
COREPATH/classes/controller/hybrid.php @ line 94
COREPATH/classes/request.php @ line 406
DOCROOT/index.php @ line 38
I found a post around 7 months ago regarding the same error, but only one response and not enough information to go by for a solution:USER
protected static $_has_one = array(
'profile' => array(
'key_from' => 'id',
'model_to' => 'Model_Profile',
'key_to' => 'id',
'cascade_save' => true,
'cascade_delete' => false,
),
'signoutsheet' => array(
'key_from' => 'id',
'model_to' => 'Model_Signoutsheet',
'key_to' => 'id',
'cascade_save' => true,
'cascade_delete' => false,
),
);
PROFILE
protected static $_belongs_to = array(
'user' => array(
'key_from' => 'id',
'model_to' => 'Model_User',
'key_to' => 'id',
'cascade_save' => true,
'cascade_delete' => false,
),
);
SIGNOUTSHEET
protected static $_belongs_to = array(
'user' => array(
'key_from' => 'id',
'model_to' => 'Model_User',
'key_to' => 'id',
'cascade_save' => true,
'cascade_delete' => false,
),
);
DELETE USER:
$user = Model_User::find($id);
$user->delete();
It looks like you're new here. If you want to get involved, click one of these buttons!