2016-03-08 72 views
1

這是一個非常明確的錯誤消息,但由於某些原因,我一直無法包裹我的頭。路徑「sylius_cart.resources.cart.classes.form」的類型無效。預期的數組,但得到了字符串symfony 2.8.3 sylius 0.17.0

配置:

sylius_cart: 
# The driver used for persistence layer. 
driver: ~ 
# Service id of cart item resolver. 
resolver: app.cart_item_resolver 
# Cart provider service id. 
provider: sylius.cart_provider.default 
# The id of cart storage for default provider. 
storage: sylius.cart_storage.session 
resources: 
    cart: 
     classes: 
      controller: Sylius\Bundle\CartBundle\Controller\CartController 
      form:  Sylius\Bundle\CartBundle\Form\Type\CartType 
     validation_groups: 
      default: [ sylius ] 
    cart_item: 
     classes: 
      controller: Sylius\Bundle\CartBundle\Controller\CartItemController 
      form:  Sylius\Bundle\CartBundle\Form\Type\CartItemType 
     validation_groups: 
      default: [ sylius ] 

當我運行

$ php app/console doctrine:schema:update --force

我得到錯誤:

[Symfony\Component\Config\Definition\Exception\InvalidTypeException] Invalid type for path "sylius_cart.resources.cart.classes.form". Expected array, but got string

回答

2

正如你可以在Configurationsylius_cart.resources.cart.classes.form看到希望用一個鍵的數組default

->arrayNode('form') 
    ->addDefaultsIfNotSet() 
    ->children() 
     ->scalarNode('default')->defaultValue(CartType::class)->cannotBeEmpty()->end() 
    ->end() 
->end() 

您需要將您的配置更改爲

//... 
resources: 
    cart: 
     classes: 
      controller: Sylius\Bundle\CartBundle\Controller\CartController 
      form: 
       default: Sylius\Bundle\CartBundle\Form\Type\CartType 
     validation_groups: 
      default: [ sylius ] 
    cart_item: 
     classes: 
      controller: Sylius\Bundle\CartBundle\Controller\CartItemController 
      form: 
       default: Sylius\Bundle\CartBundle\Form\Type\CartItemType 
     validation_groups: 
      default: [ sylius ] 
+0

感謝你,因爲它固定 –

相關問題