https://github.com/proklung/bitrixannotatedresolversbundle
Битриксовые конвертеры для бандла AnnotatedParamResolverBundle
https://github.com/proklung/bitrixannotatedresolversbundle
bitrix bitrix-symfony php7 symfony-bundle
Last synced: 2 months ago
JSON representation
Битриксовые конвертеры для бандла AnnotatedParamResolverBundle
- Host: GitHub
- URL: https://github.com/proklung/bitrixannotatedresolversbundle
- Owner: ProklUng
- License: mit
- Created: 2021-04-20T15:59:07.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-14T11:46:42.000Z (over 3 years ago)
- Last Synced: 2024-12-25T21:24:15.311Z (4 months ago)
- Topics: bitrix, bitrix-symfony, php7, symfony-bundle
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
- License: LICENSE
Awesome Lists containing this project
README
# Битриксовые конвертеры для бандла AnnotatedParamResolverBundle
Конверторы для бандла [https://github.com/ProklUng/AnnotatedParamResolverBundle](AnnotatedParamResolverBundle), без
него он не имеет смысла, да и не запустится:1) **BitrixFile**
В action контроллера, при запросе вида /route?file=7; где 7 - битриксовый ID файла, будет лежать массив,
идентичный тому, что отдает CFile::GetFileArray.~~~php
use Prokl\BitrixAnnotatedResolversBundle\Annotation\BitrixFile;
use Prokl\BitrixAnnotatedResolversBundle\ArgumentsResolver\Services\BitrixFileParam;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;class SampleControllerBitrixFile extends AbstractController
{
/**
* Параметры аннотации необязательны!
*
* @param BitrixFileParam $file
* @return JsonResponse $content
* @BitrixFile(
* var="file"
* )
*/
public function action(
BitrixFileParam $file
): JsonResponse {return new JsonResponse([
'url' => $file->url()
]);
}
}
~~~2) **BitrixFileUrl**
В action контроллера будет лежать URL файла при запросе вида /route?file=7. Где 7 - битриксовый ID файла.~~~php
use Prokl\BitrixAnnotatedResolversBundle\Annotation\BitrixFileUrl;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;class SampleControllerBitrixFileUrl extends AbstractController
{
/**
* Параметры аннотации необязательны!
*
* @param string $file
* @return JsonResponse $content
* @BitrixFileUrl(
* var="file"
* )
*/
public function action(
string $file
): JsonResponse {return new JsonResponse([
'url' => $file
]);
}
}
~~~