PHP code example of synolia / sylius-akeneo-plugin

1. Go to this page and download the library: Download synolia/sylius-akeneo-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/ */

    

synolia / sylius-akeneo-plugin example snippets


    Synolia\SyliusAkeneoPlugin\SynoliaSyliusAkeneoPlugin::class => ['all' => true],
    

   
   
   declare(strict_types=1);
   
   namespace App\Entity\Product;
   
   use App\Entity\Product\ProductTranslation;
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\Product as BaseProduct;
   use Sylius\Component\Product\Model\ProductTranslationInterface;
   use Synolia\SyliusAkeneoPlugin\Entity\ProductAssetTrait;
   
   /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_product")
    */
   #[ORM\Entity]
   #[ORM\Table(name: 'sylius_product')]
   class Product extends BaseProduct
   {
       use ProductAssetTrait {
           __construct as private initializeAssetsCollection;
       }
   
       public function __construct()
       {
           parent::__construct();
           $this->initializeAssetsCollection();
       }
   
       protected function createTranslation(): ProductTranslationInterface
       {
           return new ProductTranslation();
       }
   }
   

   

   declare(strict_types=1);

   namespace App\Entity\Product;
   
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant;
   use Sylius\Component\Product\Model\ProductVariantTranslationInterface;
   use Synolia\SyliusAkeneoPlugin\Entity\ProductVariantAssetTrait;

   /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_product_variant")
    */
   #[ORM\Entity]
   #[ORM\Table(name: 'sylius_product_variant')]
   class ProductVariant extends BaseProductVariant
   {
       use ProductVariantAssetTrait {
           ProductVariantAssetTrait::__construct as private initializeAssetsCollection;
       }
   
       public function __construct()
       {
           parent::__construct();
   
           $this->initializeAssetsCollection();
       }
   
       protected function createTranslation(): ProductVariantTranslationInterface
       {
           return new ProductVariantTranslation();
       }
   }
   

   
   
   declare(strict_types=1);
   
   namespace App\Entity\Taxonomy;
   
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\Taxon as BaseTaxon;
   use Sylius\Component\Taxonomy\Model\TaxonTranslationInterface;
   use Synolia\SyliusAkeneoPlugin\Component\TaxonAttribute\Model\TaxonAttributeSubjectInterface;
   use Synolia\SyliusAkeneoPlugin\Entity\TaxonAttributesTrait;
   
   /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_taxon")
    */
   #[ORM\Entity]
   #[ORM\Table(name: 'sylius_taxon')]
   class Taxon extends BaseTaxon implements TaxonAttributeSubjectInterface
   {
       use TaxonAttributesTrait {
           __construct as private initializeTaxonAttributes;
       }
   
       public function __construct()
       {
           parent::__construct();
   
           $this->createTranslation();
           $this->initializeTaxonAttributes();
       }
   
       protected function createTranslation(): TaxonTranslationInterface
       {
           return new TaxonTranslation();
       }
   }