protected function onPersist($id) { // $id property may be marked as read-only $this->setReadOnlyValue('id', $id); $this->persistedId = $this->getValue('id'); $this->modified = []; }