maximaster / bitrix-agent
Удобный интерфейс для работы с агентами.
v1.0.0
2024-08-28 14:01 UTC
Requires
- php: ^7.4
- doctrine/collections: ^1.0
- maximaster/bitrix-enums: >=18.5
- maximaster/bitrix-value-objects: ^1.0
- symfony/polyfill-php80: ^1.30
- webmozart/assert: ^1.11
This package is auto-updated.
Last update: 2024-10-28 14:17:13 UTC
README
Удобный интерфейс для работы с агентами.
composer require maximaster/bitrix-agent
CRUD пример
use Maximaster\BitrixAgent\Agent\Agent; use Maximaster\BitrixAgent\AgentRepository\AgentTable; use Maximaster\BitrixAgent\AgentRepository\BitrixAgentRepository; use Maximaster\BitrixValueObjects\Main\ModuleId; $agent = Agent::flexible( 'hello_world();', ModuleId::main(), new DateTimeImmutable(), new DateInterval('P1D') ); $agentRepo = new BitrixAgentRepository(); $agentRepo->save($agent); $agent = $agentRepo->allFit([AgentTable::NAME => 'hello_world();'])->get(0); $agent->scheduleAt(new DateTimeImmutable('+1 day')); $agentRepo->save($agent); $agentRepo->remove($agent);
Можно помечать агенты тегами
use Maximaster\BitrixAgent\Agent\Agent; use Maximaster\BitrixAgent\AgentRepository\BitrixAgentRepository; $agent = Agent::flexible( 'hello_world();', ModuleId::main(), new DateTimeImmutable(), new DateInterval('P1D') ); $agent->tag('service'); $agentRepo = new BitrixAgentRepository(); $agentRepo->save($agent); $agents = $agentRepo->allTagged('service');