$entity = $this->em()->create('Vendor\AddOn:Entity');$entity->column = $value;$entity->save();FormAction at the very least, but the above will work for starters. If you need help with more fundamental aspects (fetching input from the controller, creating entities and tables, etc) I'd recommend having a look at the tutorial. Otherwise if you have specific questions feel free to ask.Have you made your entity file and created the pertinent table in your setup file and local database?
If so, you can create entities like this (assuming you're in a controller):$entity = $this->em()->create('Vendor\AddOn:Entity');
Then you can assign the values from your form input:$entity->column = $value;
And finally save the entity to the database:$entity->save();
It wouldn't be a bad idea to encapsulate the creation process in a service if there is anything more complex than that going on, or maybe aFormActionat the very least, but the above will work for starters. If you need help with more fundamental aspects (fetching input from the controller, creating entities and tables, etc) I'd recommend having a look at the tutorial. Otherwise if you have specific questions feel free to ask.
public function actionSave(ParameterBag $params)
{
$this->assertPostOnly();
$visitor = \XF::visitor();
if (!$visitor->canAddMatch())
{
throw $this->exception($this->noPermission());
}
if ($params->match_id)
{
$match = $this->assertMatchExists($params->match_id);
}
else
{
$match = $this->em()->create('AH\Matchmaking:Match');
}
$title = $this->filter('title', 'str');
$description = $this->filter('description', 'str');
$platform = $this->filter('platform', 'str');
$voice = $this->filter('voice', 'bool');
$match->title = $title;
$match->description = $description;
$match->platform = $platform;
$match->voice = $voice;
$match->username = $visitor;
$match->save();
$reply = $this->view('AH\Matchmaking:Index', 'ah_mm_overview');
return $reply;
}
Have you made your entity file and created the pertinent table in your setup file and local database?
If so, you can create entities like this (assuming you're in a controller):$entity = $this->em()->create('Vendor\AddOn:Entity');
Then you can assign the values from your form input:$entity->column = $value;
And finally save the entity to the database:$entity->save();
It wouldn't be a bad idea to encapsulate the creation process in a service if there is anything more complex than that going on, or maybe aFormActionat the very least, but the above will work for starters. If you need help with more fundamental aspects (fetching input from the controller, creating entities and tables, etc) I'd recommend having a look at the tutorial. Otherwise if you have specific questions feel free to ask.
Make sure your form input for the title is namedtitleand the voice input is namedvoice. You can check the filtered values using a debugger, or by simplydie(var_dump()ing the variables if you don't have a debugger available.
<xf:macro template="ah_mm_match_edit_macros" name="title"
arg-match="{$match}" />
<xf:macro name="title" arg-match="!">
<xf:textboxrow
label="{{ phrase('title') }}"
type="match"
textbox-value="{$match.title}"
maxlength="{{ max_length($match, 'title') }}"
placeholder="{{ phrase('title...') }}" />
</xf:macro>
You have nonameattribute on yourxf:textboxrow.
We use essential cookies to make this site work, and optional cookies to enhance your experience.