Зміни в документі 3. Власні API методи
Остання зміна 2024/05/16 12:34 автором Ashterix
Підсумок
-
Властивості сторінки (1 змінено, 0 додано, 0 видалено)
Подробиці
- Властивості сторінки
-
- Вміст
-
... ... @@ -1,1 +1,34 @@ 1 1 текст 2 + 3 +{{code language="php" layout="LINENUMBERS" title=" 4 + 5 +ExampleApi"}} 6 +<?php 7 +namespace App\Api\Procedures; 8 + 9 +use App\Api\DTO\FormDTO; 10 +use App\CQRS\Query\FormQuery; 11 +use App\VO\FormObject; 12 +use Symfony\Component\Validator\Constraints as Assert; 13 +use Ufo\JsonRpcBundle\ApiMethod\Interfaces\IRpcService; 14 +use Ufo\RpcObject\RPC; 15 + 16 +class ExampleApi implements IRpcService 17 +{ 18 + public function __construct( 19 + // connecting some dependencies to retrieve data 20 + ) {} 21 + 22 + public function getUserNameByUuid(string $userId): string 23 + { 24 + // some logic get user info by id 25 + return 'some result'; 26 + } 27 + 28 + public function sendEmail(string $email, string $subject, string $text): bool 29 + { 30 + // some logic send email 31 + return true; 32 + } 33 +} 34 +{{/code}}