承接 whitedigital-eu/storage-item-resource 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

whitedigital-eu/storage-item-resource

最新稳定版本:0.3.2

Composer 安装命令:

composer require whitedigital-eu/storage-item-resource

包简介

Storage Item resource

README 文档

README

System Requirements

PHP 8.1+
Symfony 6.2+

Installation

The recommended way to install is via Composer:

composer require whitedigital-eu/storage-item-resource

With the help of vich/uploader-bundle this package enables file upload when used with api platform. After this, you need to update your database schema to use StorageItem entity.
If using migrations:

bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate

If by schema update:

bin/console doctrine:schema:update --force

This will enable new StorageItem api resource with /api/storage_items iri. If you want different iri, see https://github.com/whitedigital-eu/entity-resource-mapper#extended-api-resource how to override it.

Overriding default api resource (and therefore api endpoints)

By default, StorageItem resource is based on StorageItemResource
If you wish not to use this resource and not expose the api endpoints it provides, just set a custom api resource path with a configuration value. If you set it as null, api platform will not register api resource located within this package.

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

After overriding default api resource, do not forget to update ClassMapperConfigurator configuration that is used for resource <-> entity mapping in whitedigital-eu/entity-resource-mapper-bundle

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);
    }
}

统计信息

  • 总下载量: 584
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-06