PHP code example of dynamic / silverstripe-foxy

1. Go to this page and download the library: Download dynamic/silverstripe-foxy 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/ */

    

dynamic / silverstripe-foxy example snippets


<?

namespace {

    use Dynamic\Products\Page\Product;
    use SilverStripe\ORM\DataExtension;

    class ProductOptionDataExtension extends DataExtension
    {
        private static $belongs_many_many = [
            'Products' => Product::class,
        ];
    }
}



namespace {

    use Dynamic\Products\Page\Product;
    use SilverStripe\ORM\DataExtension;

    /**
     * Class VariationDataExtension
     */
    class VariationDataExtension extends DataExtension
    {
        /**
         * @var string[]
         */
        private static $has_one = [
            'Product' => Product::class,
        ];
    }
}