2016-11-26 2 views
0

I shop_user Modell SyliusCoreBundle außer Kraft setzen wollen, habe ich die instructions gefolgt, aber es gibt zwei Probleme.Sylius Zwingende ShopUser Modell

  1. In Lehre config-Datei, wenn ich „sylius_shop_user“ als Tabellennamen verwenden, heißt es, dass diese Tabelle bereits vorhanden ist. The table with name 'sylius_dev.sylius_shop_user' already exists.

  2. wenn ich shop_user Modell der Klasse außer Kraft setzen wollen, bekomme ich diesen Fehler: Unrecognized option "shop_user" under "sylius_core.resources"

Antwort

2

Hier ist meine Config für die 1.0.0-alpha.1 :)

sylius_user: 
    resources: 
     shop: 
      user: 
       classes: 
        model: AppBundle\Entity\ShopUser 
        repository: AppBundle\Entity\Repository\ShopUserRepository 
        form: 
         default: AppBundle\Form\Type\Api\UserType 

sylius_resource: 
    resources: 
     app.shop_user: 
      classes: 
       model: AppBundle\Entity\ShopUser 
       repository: AppBundle\Entity\Repository\ShopUserRepository 
       controller: AppBundle\Controller\Api\UserController 

sylius_api: 
    resources: 
     api_user: 
      classes: 
       model: "%sylius.model.shop_user.class%" 

doctrine: 
    orm: 
     resolve_target_entities: 
      AppBundle\Entity\ShopUserInterface: AppBundle\Entity\ShopUser 

ShopUser.php

namespace AppBundle\Entity; 

use Sylius\Component\Core\Model\ShopUser as BaseShopUser; 

class ShopUser extends BaseShopUser implements ShopUserInterface {...} 

ShopUserInterface.php

namespace AppBundle\Entity; 

use Doctrine\Common\Collections\ArrayCollection; 
use Sylius\Component\Core\Model\ShopUserInterface as BaseShopUserInterface; 

interface ShopUserInterface extends BaseShopUserInterface {...} 

ShopUserRepository.php

namespace AppBundle\Entity\Repository; 

use Sylius\Bundle\CoreBundle\Doctrine\ORM\UserRepository as BaseUserRepository; 

class ShopUserRepository extends BaseUserRepository implements ShopUserRepositoryInterface {...} 

ShopUserRepositoryInterface.php

namespace AppBundle\Entity\Repository; 

use Sylius\Component\User\Repository\UserRepositoryInterface; 

interface ShopUserRepositoryInterface extends UserRepositoryInterface {...} 

/src/AppBundle/Resources/config/doctrine/ShopUser.orm.xml

<?xml version="1.0" encoding="UTF-8"?> 

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping 
              http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> 

    <entity name="AppBundle\Entity\ShopUser" table="sylius_shop_user" repository-class="AppBundle\Entity\Repository\ShopUserRepository"> 
     ... 
    </entity> 

</doctrine-mapping> 

src/AppBundle/Ressourcen/config/s erializer/Entity.ShopUser.yml

AppBundle\Entity\ShopUser: 
    exclusion_policy: ALL