PHP code example of whitedigital-eu / storage-item-resource

1. Go to this page and download the library: Download whitedigital-eu/storage-item-resource 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/ */

    

whitedigital-eu / storage-item-resource example snippets


use Symfony\Config\StorageItemResourceConfig;
return static function (StorageItemResourceConfig $config): void {
    $config->customApiResourcePath('%kernel.project_dir%/src/MyCustomPath')
    // or  ->customApiResourcePath(null);
};

use App\ApiResource\Admin\StorageItemResource;
use WhiteDigital\StorageItem\Entity\StorageItem;
use WhiteDigital\EntityResourceMapper\Mapper\ClassMapper;
use WhiteDigital\EntityResourceMapper\Mapper\ClassMapperConfiguratorInterface;
final class ClassMapperConfigurator implements ClassMapperConfiguratorInterface
{
    public function __invoke(ClassMapper $classMapper): void
    {
        $classMapper->registerMapping(StorageItemResource::class, StorageItem::class);
    }
}