/** * @param \SplSubject|Logic $subject */ protected function fillJoins($subject) { $models = $subject->getEventObject(); $modelConfig = $subject->getModelService()->getParsedModelConfig($subject->getModelName()); if (!(is_array($models) || $models instanceof ResultSetInterface)) { $models = [$models]; } $aModels = []; foreach ($models as $_k => $aclModel) { if ($aclModel instanceof AclDataModel) { $mymodel = $aclModel->getDataModel(); } else { $mymodel = $aclModel; } foreach ($modelConfig->joins as $_k => $join) { if ($join['type'] == 'lookup') { $this->fillLookup($join, $subject, $mymodel); } elseif ($join['type'] == 'static_lookup') { $this->fillStaticLookup($join, $subject, $mymodel); } } $aModels[] = $mymodel->getArrayCopy(); } if ($models instanceof ResultSetInterface) { $models->initialize($aModels); } // else // { // $models = $aModels; // } }
/** * @param string $eventName * @param string $modelName * * @return DataLogic|void * @throws \Exception */ public function createLogic($eventName, $modelName) { $logicConfig = $this->getConfigServiceVerify()->getByObject($modelName . '.' . $eventName, new LogicConfig()); $logic = new Logic(); if ($logicConfig == null) { return $logic; } $logic->setLogicConfig($logicConfig); $logic->setConfigService($this->getConfigServiceVerify()); $logic->setGatewayService($this->getGatewayServiceVerify()); $logic->setAuthService($this->getAuthServiceVerify()); $logic->setModelService($this->getModelService()); $logic->setLogicService($this); $logic->setMailService($this->getMailService()); $logic->setQueryService($this->getQueryServiceVerify()); $logic->setFileService($this->getFileServiceVerify()); $logic->setFilesystemService($this->getFilesystemServiceVerify()); if ($this->getParams() != null) { $logic->setParams($this->getParams()); } $logic->init(); return $logic; }