solutionDrive / SyliusProductBundlesPlugin

Plugin for Sylius to configure bundles for products that can be sold together
MIT License
20 stars 4 forks source link

Creating products with generator fails #24

Closed twojtylak closed 6 years ago

twojtylak commented 6 years ago

In the product entity the field code is mandatory, so calling:

$productBundle = $this->productBundleCreator->createProductBundle($product->getName(), $product);
$em->persist();
$em->flush();

fails.

[PDOException (23000)] SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: solutiondrive_product_bundle.code

So either we

https://github.com/solutionDrive/SyliusProductBundlesPlugin/blob/84d57030be3646700c18a98d4c3d1df413625c48/src/Service/ProductBundleCreator.php#L37-L44

mattagohni commented 6 years ago

I just had a look where the CodeAwareInterface is used and it seems on first glance almost every Resource-Interface extends the CodeAwareInterface. So maybe there is a good chance that it is not the best idea to remove it entierely. bildschirmfoto 2018-03-13 um 10 23 30

mattagohni commented 6 years ago

If we would take the name and the code from the product (maybe with a fixed pre- or suffix to have it unique throughout the system), we could also get rid of the first parameter for the createProductBundle-Method.

mattagohni commented 6 years ago

@twojtylak is this also fixed by #27 ?

twojtylak commented 6 years ago

yes