Hello,
Before alpha version i have customized product Model/Form/Repository by adding two new fields , everything works fine. After upgrading to alpha and alpha.1 the follow exception occurs:
Neither the property "variantSelectionMethod" nor one of the methods "variantSelectionMethod()", "getvariantSelectionMethod()"/"isvariantSelectionMethod()" or "__call()" exist and have public access in class "SymfonyComponentFormFormView" in @SyliusAdmin/Product/Tab/_details.html.twig at line 21.
After some debug the problem seems to be in my custom Form ProductType:
config.yml
sylius_product:
resources:
product:
classes:
model: AppBundle\Entity\Product
repository: AppBundle\Repository\ProductRepository
form:
default: AppBundleForm\Type\ProductType
ProductType.php
`
namespace AppBundleForm\Type;
use SyliusBundle\ProductBundleForm\Type\ProductType as BaseProductType;
use SymfonyComponentForm\Extension\Core\Type\CheckboxType;
use SymfonyComponentFormFormBuilderInterface;
class ProductType extends BaseProductType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
// Add default fields from the BaseAddressType that you are extending.
parent::buildForm($builder, $options);
// Adding new fields works just like in the parent form.
$builder
->add('featured', CheckboxType::class, [
'required' => false,
'label' => 'app.form.product.featured',
])
->add('promotion', CheckboxType::class, [
'required' => false,
'label' => 'app.form.product.promotion',
])
;
}
}`
I follow the docs, what could be wrong ?
regards
CV
If you're using the CoreBundle, try extending the CoreBundle's ProductType instead of the one from the ProductBundle in your ProductType.
^ that's the solution, please reopen if still a problem. :)
Most helpful comment
If you're using the CoreBundle, try extending the CoreBundle's ProductType instead of the one from the ProductBundle in your ProductType.