<?php

namespace Application\Service\Logic\form;

use Application\Service\BaseService;
use Application\Service\Extension\CheckLogic\CheckLogicApplication;
use Application\Service\Extension\Laminas;
use Laminas\Stdlib\ArrayUtils;

class CheckFormLogic extends BaseService
{
    public function execute($where = '')
    {
        if(empty($where)) $where = [];
        if(is_string($where)) $where = [ $where];

        $query = $this->LocalService()->itemPatientFormLogic->fetchAll([
            'where' => ArrayUtils::merge([
                'is_del' => 0,
            ], $where)
        ]);

        foreach($query as $ex){
            $generator = unserialize($ex['generator']);
            $app = new CheckLogicApplication();
            $app::$debugMode = false;
            $app->setItemId($ex['item_id'])
                ->setGenerator($generator)
                ->execute();
        }
    }
}