如何在另一个项目中重用sylius组件?

I recently got to know the Sylius project and was trying to reuse its components in a separate project (study only).

My goal was to test if I can use the sylius components in a separate project. Only a few components.

Following the documentation (http://sylius-older.readthedocs.io/en/latest/components/Order/basic_usage.html), I was able to install the components and use their classes, but how do I do the database tables?

I installed the doctrine and tried to map the classes, but I could not.

I was thinking of creating the migration (doctrine or eloquent) for each table and doing the actions (CRUD).

Thank you so much guys.

Assuming you have installed the OrderBundle using Composer you will probably have to tell Doctrine where to read the entity mapping. In case of Sylius' OrderBundle they are stored as xml files in Resources/config/doctrine/models, e.g. Order.orm.xml. If you look at the sample configuration in the DoctrineBundle-recipe you can find a reference for a manual mapping. In your case it probably should look something like this:

# app/config/config.yml (in Symfony 3.4)
# config/packages/doctrine.yaml (in Symfony 4)
doctrine:
    dbal:
        ...
    orm:
        mappings:
            SyliusOrderBundle:
                is_bundle: false
                type: xml
                dir: '%kernel.project_dir%/../vendor/sylius/order-bundle/Resources/config/doctrine/models'
                prefix: 'Sylius\Component\Order\Model'
                alias: SyliusOrder

You might have to tweak this, e.g. if you have a Symfony 4 app, but with this you should be able to create the appropriate schema using the default Doctrine commands. You might also have to adjust auto_mapping under doctrine.orm and possibly manually map your own entities if you do this.