Sylius / Sylius-Docs

DEPRACATED. See Sylius/Sylius repository.
http://sylius.org
56 stars 99 forks source link

Sylius\Component\Promotion\Model\PromotionInterface does not exist #319

Closed azamalvi closed 9 years ago

azamalvi commented 9 years ago

When I try to update schema then I got this error. When I look inside my vendors Sylius folder I did not find any component folder there. It seem that composer did not download this because I searched about this and found that "This package is abandoned and no longer maintained. No replacement package was suggested" So how can I use Promotion bundle?

michalmarcinkowski commented 9 years ago

What Sylius version do you use?

azamalvi commented 9 years ago

I just run below two lines one by one

$ composer require sylius/promotion:* $ composer require "sylius/promotion-bundle"

then in my composer.json they were included as

"sylius/promotion": "*", "sylius/promotion-bundle": "^0.15.0"

michalmarcinkowski commented 9 years ago

Try simply composer require "sylius/promotion-bundle" and remember to add required bundles http://docs.sylius.org/en/latest/bundles/SyliusPromotionBundle/installation.html

azamalvi commented 9 years ago

I have done same as you described but same problem :(

michalmarcinkowski commented 9 years ago

Try to remove this line https://github.com/Sylius/Sylius/pull/3266/files in vendors.

azamalvi commented 9 years ago

Same error. Here is my configuration setting

sylius_promotion: driver: doctrine/orm classes: promotion_subject: model: My\OrdersBundle\Entity\Orders

stof_doctrine_extensions: orm: default: timestampable: true

michalmarcinkowski commented 9 years ago

Do you have vendor/sylius/promotion/Model/PromotionInterface.php class in your project directory?

azamalvi commented 9 years ago

@michalmarcinkowski yes I have this class in above mentioned directory.

pjedrzejewski commented 9 years ago

@azamalvi This is really weird, could you try reinstalling Sylius? It is impossible that this class does not exist. Have you modified Composer autoload or something? Could you also give us full exception?

Also, according to the docs:

"Please register the bundle before DoctrineBundle. This is important as we use listeners which have to be processed first."

I am guessing that's the cause of your problem, but not sure, as you have pasted only part of the exception.

azamalvi commented 9 years ago

@pjedrzejewski bellow are the complete steps that I performed one by one.

Update Composer composer require "sylius/promotion-bundle"

Register Bundle new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new Sylius\Bundle\PromotionBundle\SyliusPromotionBundle(), new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),

remaining bundles were already registered.

config.yml sylius_promotion: driver: doctrine/orm classes: promotion_subject: model: Acme\OrdersBundle\Entity\Orders

stof_doctrine_extensions: orm: default: timestampable: true

routing.yml sylius_promotion: resource: "@SyliusPromotionBundle/Resources/config/routing.yml"

Schema Update Now at this point when I update schema then I received the following error.

[Doctrine\Common\Persistence\Mapping\MappingException] Class 'Sylius\Component\Promotion\Model\PromotionInterface' does not exist

michalmarcinkowski commented 9 years ago

@azamalvi "Please register the bundle before DoctrineBundle. This is important as we use listeners which have to be processed first." - did you register these bundles before DoctrineBundle?

azamalvi commented 9 years ago

@michalmarcinkowski yes I have already registered this bundle in Appkernal.php and here is the settings in config.yml that I have use it

doctrine: orm: auto_generate_proxy_classes: "%kernel.debug%" entity_managers: default: auto_mapping: true metadata_cache_driver: '%cache_driver%' query_cache_driver: '%cache_driver%' result_cache_driver: '%cache_driver%' mappings: SonataMediaBundle: ~ ApplicationSonataMediaBundle: ~ ApplicationSonataClassificationBundle: ~

azamalvi commented 9 years ago

It is fixed I just update the doctrine/doctrine-bundle to latest one and now it works fine. I don't know what the hack was.