Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Sylius覆盖的ShopUser模型_Php_Symfony_Sylius - Fatal编程技术网

Php Sylius覆盖的ShopUser模型

Php Sylius覆盖的ShopUser模型,php,symfony,sylius,Php,Symfony,Sylius,我想覆盖SyliusScoreBundle的shop_用户模型,我遵循了,但有两个问题 在配置文件中,当我使用“sylius_shop_user”作为表名时, 它说这个表已经存在了具有名称的表 “sylius_dev.sylius_shop_user”已存在。 当我想要覆盖shop\u用户模型的类时,我会遇到以下错误:无法识别的选项“sylius\u core.resources”下的“shop\u user” 这是我对1.0.0-alpha.1的配置:) ShopUser.php namesp

我想覆盖SyliusScoreBundle的shop_用户模型,我遵循了,但有两个问题

  • 在配置文件中,当我使用“sylius_shop_user”作为表名时, 它说这个表已经存在了<代码>具有名称的表 “sylius_dev.sylius_shop_user”已存在。

  • 当我想要覆盖shop\u用户模型的类时,我会遇到以下错误:
    无法识别的选项“sylius\u core.resources”下的“shop\u user”


  • 这是我对1.0.0-alpha.1的配置:)

    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 {...}
    
    namespace AppBundle\Entity\Repository;
    
    use Sylius\Component\User\Repository\UserRepositoryInterface;
    
    interface ShopUserRepositoryInterface extends UserRepositoryInterface {...}
    
    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;
    
    use Doctrine\Common\Collections\ArrayCollection;
    use Sylius\Component\Core\Model\ShopUserInterface as BaseShopUserInterface;
    
    interface ShopUserInterface extends BaseShopUserInterface {...}
    
    namespace AppBundle\Entity\Repository;
    
    use Sylius\Component\User\Repository\UserRepositoryInterface;
    
    interface ShopUserRepositoryInterface extends UserRepositoryInterface {...}
    
    /src/AppBundle/Resources/config/doctor/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>
    

    这是我对1.0.0-alpha.1的配置:)

    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 {...}
    
    namespace AppBundle\Entity\Repository;
    
    use Sylius\Component\User\Repository\UserRepositoryInterface;
    
    interface ShopUserRepositoryInterface extends UserRepositoryInterface {...}
    
    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;
    
    use Doctrine\Common\Collections\ArrayCollection;
    use Sylius\Component\Core\Model\ShopUserInterface as BaseShopUserInterface;
    
    interface ShopUserInterface extends BaseShopUserInterface {...}
    
    namespace AppBundle\Entity\Repository;
    
    use Sylius\Component\User\Repository\UserRepositoryInterface;
    
    interface ShopUserRepositoryInterface extends UserRepositoryInterface {...}
    
    /src/AppBundle/Resources/config/doctor/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>