abdfahim
Well-known member
I am trying to imitate the existing xxxxSaveProcess functions to save data from a new account/section to a new table in my database, but so far have not succeeded. What step am I skipping? Is it because basicEntitySave() can only insert data, not update? I want it to update if a record exists, otherwise, insert a new row.
Error:
Code:
class Account extends XFCP_Account
{
public function actionNewSection()
{
if ($this->isPost())
{
$visitor = \XF::visitor();
if ($visitor->canEditProfile())
{
$this->newSectionSaveProcess($visitor->user_id)->run();
}
return $this->redirect($this->buildLink('account/new-section'));
}
else
{
$view = $this->view('XF:Account\NewSection', 'abdfahim_new_section');
return $this->addAccountWrapperParams($view, 'abdfahim_new_section');
}
}
protected function newSectionSaveProcess($userid)
{
$form = $this->formAction();
$input = $this->filter([
'col1' => 'str',
'col2' => 'str',
'user_id' => $userid
]);
//var_dump($input);
$entity = $this->em()->create('AbdFahim\MyAddon:MyEntity');
$form->basicEntitySave($entity, $input);
return $form;
}
}
Error:
InvalidArgumentException: Unknown filter type 1 in src/XF/InputFilterer.php at line 412