PHP code example of monsieurbiz / sylius-shipping-slot-plugin

1. Go to this page and download the library: Download monsieurbiz/sylius-shipping-slot-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

monsieurbiz / sylius-shipping-slot-plugin example snippets


return [
    // ...
    MonsieurBiz\SyliusShippingSlotPlugin\MonsieurBizSyliusShippingSlotPlugin::class => ['all' => true],
];
diff
namespace App\Entity\Shipping;

use Doctrine\ORM\Mapping as ORM;
+use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodInterface as MonsieurBizShippingMethodInterface;
+use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodTrait;
use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod;
use Sylius\Component\Shipping\Model\ShippingMethodTranslationInterface;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_shipping_method")
 */
#[ORM\Entity]
#[ORM\Table(name: 'sylius_shipping_method')]
-class ShippingMethod extends BaseShippingMethod
+class ShippingMethod extends BaseShippingMethod implements MonsieurBizShippingMethodInterface
{
+    use ShippingMethodTrait {
+        ShippingMethodTrait::__construct as private shippingMethodTraitConstruct;
+    }
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->shippingMethodTraitConstruct();
+    }
+
    protected function createTranslation(): ShippingMethodTranslationInterface
    {
        return new ShippingMethodTranslation();
    }
}