Sylius: Extending core model Customer does not seem to work

Created on 22 Sep 2016  路  4Comments  路  Source: Sylius/Sylius

I trying to extend Customer model according to the documentation and a former issue: http://docs.sylius.org/en/latest/customization/model.html
https://github.com/Sylius/Sylius/issues/5519

I want to add a custom field in Customer class.

Here are the files I wrote :

src/AppBundle/Entity/Customer.php

<?php
namespace AppBundle\Entity;
use Sylius\Component\Core\Model\Customer as BaseCustomer;
class Customer extends BaseCustomer
{
  ...
}

src/AppBundle/Resources/config/doctrine/Customer.orm.yml

AppBundle\Entity\Customer:
    type: entity
    table: sylius_customer
    fields:
        ...

app/config/config.yml

sylius_user:
    resources:
        customer:
            classes:
                model: AppBundle\Entity\Customer

But I get the following error :

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
Unrecognized option "model" under "sylius_user.resources.customer"

I don't know whether it's a bug or a lack of documentation

Most helpful comment

@gdecorbiac we're working hard on documentation also. Please have a look here and share your thoughts on how we could make the docs easier to understand :)

All 4 comments

I think that's a lack of documentation. Take a look at sylius.yml

customer is under sylius_customer now

Thanks Niiko.
I'm quite new to Symfony and Sylius and the doc is sometimes very hard to understand.
But I'll deal with it because it's very promising and I love the dev friendly philosophy of Sylius !!

No problem, my pleasure,

@gdecorbiac we're working hard on documentation also. Please have a look here and share your thoughts on how we could make the docs easier to understand :)

Was this page helpful?
0 / 5 - 0 ratings