I can change the options that component without a problem using the generated check boxes however, if I decide that I want to untick all of the checkboxes then I get the following error:
Notice: Undefined offset: 2
500 Internal Server Error - ContextErrorException
in src/App/MyBundle/Model/om/BaseComponentProductMapsQuery.php at line 241
Stack Trace:
$cton0 = $this->getNewCriterion(ComponentProductMapsPeer::ID, $key[0], Criteria::EQUAL);
$cton1 = $this->getNewCriterion(ComponentProductMapsPeer::COMPONENT_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$cton2 = $this->getNewCriterion(ComponentProductMapsPeer::PRODUCT_ID, $key[2], Criteria::EQUAL);
$cton0->addAnd($cton2);
$this->addOr($cton0);
}
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<database name="default" namespace="App\MyBundle\Model" defaultIdMethod="native">
<table name="component">
<column name="id"
type="integer"
required="true"
autoIncrement="true"
primaryKey="true"/>
<column name="component_type"
type="integer"/>
<column name="component_name"
type="varchar"/>
<column name="weight"
type="decimal"
size="10"
scale="2" />
<column name="height"
type="decimal"
size="10"
scale="2" />
<column name="length"
type="decimal"
size="10"
scale="2" />
<column name="depth"
type="decimal"
size="10"
scale="2" />
<column name="single_price"
type="boolean"/>
<column name="global_component"
type="boolean"
required="true"
default="0"/>
<foreign-key foreignTable="form_type">
<reference local="component_type" foreign="id" />
</foreign-key>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB" />
<parameter name="Charset" value="utf8" />
</vendor>
</table>
<table name="component_product_maps" isCrossRef="true">
<column name="id"
type="integer"
required="true"
autoIncrement="true"
primaryKey="true"/>
<column name="component_id"
type="integer"
primaryKey="true"/>
<column name="product_id"
type="integer"
primaryKey="true"/>
<foreign-key foreignTable="product" onDelete="cascade">
<reference local="product_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="component" onDelete="cascade">
<reference local="component_id" foreign="id" />
</foreign-key>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB" />
<parameter name="Charset" value="utf8" />
</vendor>
</table>
<table name="product">
<column name="id"
type="integer"
required="true"
autoIncrement="true"
primaryKey="true"/>
<column name="image"
type="varchar"
size="150"/>
<column name="sku"
type="BIGINT"/>
<column name="product_name"
type="varchar"
size="150"
required="true"/>
<column name="stock_code"
type="varchar"
size="150"
required="true"/>
<column name="long_description"
type="longvarchar"
required="true"/>
<column name="short_description"
type="varchar"
size="250"
required="true"/>
<column name="weight"
type="decimal"
size="10"
scale="2"
required="true"/>
<column name="length"
type="decimal"
size="10"
scale="2"
required="true"/>
<column name="height"
size="10"
scale="2"
type="decimal"
required="true"/>
<column name="depth"
type="decimal"
size="10"
scale="2"
required="true"/>
<column name="url"
type="varchar"
size="250"
required="true"/>
<column name="meta_description"
type="varchar"
size="250"
required="true"/>
<column name="meta_keywords"
type="varchar"
size="700"
required="true"/>
<column name="meta_title"
type="varchar"
size="255"
required="true"/>
<column name="old_url"
type="varchar"
size="250"/>
<unique>
<unique-column name="url"/>
</unique>
<unique>
<unique-column name="meta_title"/>
</unique>
<unique>
<unique-column name="sku"/>
</unique>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB" />
<parameter name="Charset" value="utf8" />
</vendor>
</table>
</database>
FormBuilder section of the Form:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('image', "file", array(
"data_class" => null
));
$builder->add('sku');
$builder->add('productName', null, array(
"label" => false
));
$builder->add('stockCode');
$builder->add('longDescription', 'textarea', array(
"label" => false
));
$builder->add('shortDescription');
$builder->add('weight');
$builder->add('length');
$builder->add('height');
$builder->add('depth');
$builder->add('url');
$builder->add('metaDescription');
$builder->add('metaKeywords');
$builder->add('metaTitle');
$builder->add('oldUrl');
$builder->add('price', "money", array(
"mapped" =>false,
'divisor' => 100,
'currency' => "USD"
));
$builder->add('components', 'model', array(
'class' => 'App\MyBundle\Model\Component',
'query' => ComponentQuery::create()->filterByGlobalComponent(1)->orderByComponentName(),
'property' => 'component_name',
'label' => "Global Components",
'required' => false,
'multiple' => true,
'expanded' => true,
'by_reference' => false
));
}
I can change the options that component without a problem using the generated check boxes however, if I decide that I want to untick all of the checkboxes then I get the following error:
Stack Trace:
Schema:
FormBuilder section of the Form: