I want to submit a form and save the values in two different tables (which are in the same database).
This is the form:
<div class="control-group">
<label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>Naam</label>
<div class="controls">
{{ form_widget(form.product) }}
{{ form_errors(form.product) }}
</div>
</div>
<div class="control-group">
<label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>Aantal</label>
<div class="controls">
{{ form_widget(form.amount) }}
{{ form_errors(form.amount) }}
</div>
</div>
This is a form builder:
$builder->add("amount", "number", array("label" => "Aantal"));
$builder->add("product", "text", array("attr" => array("autocomplete" => "off", "data-provide" => "typeahead", "data-items" => "15", "data-source" => $dataSource), 'mapped' => false));
$builder->add("price", "number", array("label" => "Aangepaste prijs", 'mapped' => false));
this is part of the object:
private $id;
private $amount;
public function getId()
{
return $this->id;
}
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
public function getAmount()
{
return $this->amount;
}
and here is the ORM:
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
amount:
type: float
Now I want to add an input field in the form named "serial_nr". I want to keep this value in a different table than where the "product" and "sum" are stored.
Can someone point me in the right direction?
source
share