Skip to content

Latest commit

 

History

History
114 lines (86 loc) · 2.91 KB

legacy_installation.md

File metadata and controls

114 lines (86 loc) · 2.91 KB

Legacy installation (without SymfonyFlex)

  1. Require plugin with composer:

    composer require sylius/refund-plugin:1.0.0-RC.7
  2. Add plugin class and other required bundles to your AppKernel:

    $bundles = [
       new \Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
       new \Sylius\RefundPlugin\SyliusRefundPlugin(),
    ];
  3. Import configuration:

    imports:
        - { resource: "@SyliusRefundPlugin/Resources/config/app/config.yml" }
  4. Import routing:

    sylius_refund:
        resource: "@SyliusRefundPlugin/Resources/config/routing.yml"
  5. Configure KnpSnappyBundle (if you don't have it configured yet):

    knp_snappy:
        pdf:
            enabled: true
            binary: #path to your wkhtmltopdf binary file
            options: []
  6. Apply migrations to your database:

    bin/console doctrine:migrations:migrate
  7. Copy Sylius templates overridden in plugin to your templates directory (e.g templates/bundles/):

    mkdir -p templates/bundles/SyliusAdminBundle/
    cp -R vendor/sylius/refund-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
  8. If you use Sylius v1.8 you also need to change files src/Entity/Shipping/Shipment.php and src/Entity/Order/Adjustment.php to use proper traits and interfaces:

    <?php
    
    declare(strict_types=1);
    
    namespace App\Entity\Order;
    
    use Doctrine\ORM\Mapping as ORM;
    use Sylius\Component\Order\Model\Adjustment as BaseAdjustment;
    use Sylius\RefundPlugin\Entity\AdjustmentInterface as RefundAdjustmentInterface;
    use Sylius\RefundPlugin\Entity\AdjustmentTrait;
    
    /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_adjustment")
    */
    class Adjustment extends BaseAdjustment implements RefundAdjustmentInterface
    {
        use AdjustmentTrait;
    }
    <?php
    
    declare(strict_types=1);
    
    namespace App\Entity\Shipping;
    
    use Doctrine\Common\Collections\ArrayCollection;
    use Doctrine\ORM\Mapping as ORM;
    use Sylius\Component\Core\Model\AdjustmentInterface as BaseAdjustmentInterface;
    use Sylius\Component\Core\Model\Shipment as BaseShipment;
    use Sylius\RefundPlugin\Entity\ShipmentTrait;
    use Sylius\RefundPlugin\Entity\ShipmentInterface as RefundShipmentInterface;
    
    /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_shipment")
    */
    class Shipment extends BaseShipment implements RefundShipmentInterface
    {
        use ShipmentTrait;
    
        public function __construct()
        {
            parent::__construct();
    
            /** @var ArrayCollection<array-key, BaseAdjustmentInterface> $this->adjustments */
            $this->adjustments = new ArrayCollection();
        }
    }
  9. Clear cache:

    bin/console cache:clear