Sylius: Maker Bundle does not work

Created on 29 Oct 2019  路  12Comments  路  Source: Sylius/Sylius

Sylius version affected: 1.6.1

Description
I installed MakerBundle via composer as explained here:
https://docs.sylius.com/en/1.6/cookbook/entities/custom-model.html
https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html

However, I get the following error message when I want to create any entity.

Steps to reproduce

acme php bin/console make:entity

Class name of the entity to create or update (e.g. VictoriousJellybean):

TestEntity

created: src/Entity/TestEntity.php
created: src/Repository/TestEntityRepository.php

[ERROR] Only annotation mapping is supported by make:entity, but the App\Entity\TestEntity class uses a
different format. If you would like this command to generate the properties & getter/setter methods, add your
mapping configuration, and then re-run this command with the --regenerate flag.

Either it is a bundle bug or a missing information in the documentation...

Bug Do not stale

Most helpful comment

Same issue with Sylius 1.6.4. Returning drivers by ...\ResourceMappingDriverChain::getDrivers is empty.

Resolve with the following patch : https://github.com/vklux/maker-bundle-force-annotation

--force-annotation flag in make:entity command.

All 12 comments

hello,
The same here. Sylius 1.6.1 / symfony 4.3.5.
Vendors deleted et composer update, but it doesn't work.

I'v tested make:entity with fresh install symfony 4 (without sylius) and it's worked

I suppose you try to use the command on sylius/sylius repository? Then indeed, it will not be supported as we use xml mapping by default. However, the doc article you've mentioned is meant to be used with sylius/sylius-standard distribution, which uses annotations mapping...

However, (馃槃) it still would not work due to some problems in SyliusResourceBundle, but they're already explained in this issue and I would like to keep the conversation there :)

Nevertheless, thanks for the report! 馃枛

@Zales0123 But it's same project that issue https://github.com/Sylius/SyliusResourceBundle/issues/103 the 7 July 2019 and worked with the hack.
And now this Error :

[ERROR] Only annotation mapping is supported by make:entity, but the <info>App\Entity\Toto</info> class uses a         
         different format. If you would like this command to generate the properties & getter/setter methods, add your  
         mapping configuration, and then re-run this command with the <info>--regenerate</info> flag.      

i've fix again the hack after a update's vendor.
tested wtih php 7.2.16 and php 7.3.3 on mac os 10.15

make:entity --no-debug doesn't work

Ok, strange 馃槃 We should investigate it

hello,
any news about his issue? Still facing the problem.

hello,
in my fresh installation, and makerBundle installed
sylius-standard have the same problem.
the hack https://github.com/Sylius/SyliusResourceBundle/issues/103 dont work anymore

In "MakeEntity.php", method "doesEntityUseAnnotationMapping", the class Driver returned by $this->doctrineHelper->getMappingDriverForClass is Doctrine\Persistence\Mapping\Driver\MappingDriverChain and not Doctrine\ORM\Mapping\Driver\AnnotationDriver

To force make:entity, i've replace the line 801 of MakeEntity.php in method doesEntityUseAnnotationMapping
return $driver instanceof AnnotationDriver;
by
return $driver instanceof AnnotationDriver || $driver instanceof MappingDriverChain;

adding infos :
third entity created and i've got the error. i've removed cache => work with hack above

Same issue with Sylius 1.6.4. Returning drivers by ...\ResourceMappingDriverChain::getDrivers is empty.

Resolve with the following patch : https://github.com/vklux/maker-bundle-force-annotation

--force-annotation flag in make:entity command.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

I am having the same problem with sylius v1.7.7 and symfony 4.4.9
I am using the sylius/sylius repository

Same issue here.
sylius v1.7.6 and symfony 4.4.10
Started from sylius/sylius-standard distribution

Sf 4.4.13 Sylius 1.8 same issue ...
Applying the patch "Resolve with the following patch : https://github.com/vklux/maker-bundle-force-annotation" resolved it !-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ping86 picture ping86  路  3Comments

javiereguiluz picture javiereguiluz  路  3Comments

tchapi picture tchapi  路  3Comments

inssein picture inssein  路  3Comments

mikemix picture mikemix  路  3Comments