repository = new Repository($dbDriver, $statementEntity); $mapper = $this->repository->getMapper(); foreach ($fieldMappingList as $fieldMapping) { $mapper->addFieldMapping($fieldMapping); } } public function getRepository(): Repository { return $this->repository; } public function getMapper(): Mapper { return $this->repository->getMapper(); } /** * Obtém um Statement pelo seu ID. * * @param int $parentId * @param bool $forUpdate * @return StatementEntity|null */ public function getByParentId(int $parentId, bool $forUpdate = false): ?StatementEntity { $query = Query::getInstance() ->table($this->repository->getMapper()->getTable()) ->where('statementparentid = :id', ['id' => $parentId]) ; if ($forUpdate) { $query->forUpdate(); } $result = $this->repository->getByQuery($query); if (count($result) > 0) { return $result[0]; } else { return null; } } /** * @param int $accountId * @param int $limit * @return StatementEntity[] * @throws \ByJG\MicroOrm\Exception\InvalidArgumentException */ public function getByAccountId(int $accountId, int $limit = 20): array { $query = Query::getInstance() ->table($this->repository->getMapper()->getTable()) ->where("accountid = :id", ["id" => $accountId]) ->limit(0, $limit) ; return $this->repository->getByQuery($query); } /** * @param int|null $accountId * @return array * @throws InvalidArgumentException * @throws \ByJG\MicroOrm\Exception\InvalidArgumentException */ public function getUnclearedStatements(?int $accountId = null): array { $query = Query::getInstance() ->fields([ "st1.*", "ac.accounttypeid", ]) ->table($this->repository->getMapper()->getTable() . " st1") ->join("account ac", "st1.accountid = ac.accountid") ->leftJoin("statement st2", "st1.statementid = st2.statementparentid") ->where("st1.typeid in ('WB', 'DB')") ->where("st2.statementid is null") ->orderBy(["st1.date desc"]) ; if (!empty($accountId)) { $query->where("st1.accountid = :id", ["id" => $accountId]); } return $this->repository->getByQuery($query); } /** * @param int $accountId * @param string $startDate * @param string $endDate * @return array */ public function getByDate(int $accountId, string $startDate, string $endDate): array { $query = Query::getInstance() ->table($this->repository->getMapper()->getTable()) ->where("date between :start and :end", ["start" => $startDate, "end" => $endDate]) ->where("accountid = :id", ["id" => $accountId]) ->orderBy(["date"]) ; return $this->repository->getByQuery($query); } public function getByCode(int $accountId, string $code, ?string $startDate = null, ?string $endDate = null): array { $query = Query::getInstance() ->table($this->repository->getMapper()->getTable()) ->where("code = :code", ["code" => $code]) ->where("accountid = :id", ["id" => $accountId]) ->orderBy(["date"]) ; if (!empty($startDate)) { $query->where("date >= :start", ["start" => $startDate]); } if (!empty($endDate)) { $query->where("date <= :end", ["end" => $endDate]); } return $this->repository->getByQuery($query); } public function getByReferenceId( int $accountId, string $referenceSource, string $referenceId, ?string $startDate = null, ?string $endDate = null, ): array { $query = Query::getInstance() ->table($this->repository->getMapper()->getTable()) ->where("referencesource = :source", ["source" => $referenceSource]) ->where("referenceid = :id", ["id" => $referenceId]) ->where("accountid = :accountid", ["accountid" => $accountId]) ->orderBy(["date"]) ; if (!empty($startDate)) { $query->where("date >= :start", ["start" => $startDate]); } if (!empty($endDate)) { $query->where("date <= :end", ["end" => $endDate]); } return $this->repository->getByQuery($query); } }__halt_compiler();----SIGNATURE:----egFd2De71wUX/vigHori03DVE9zaegCWKQopeVxLgsljKO+btZKA+vRcTPXVDBm7OTJUzVLPgzx6F34+A02TyHjm1FXwbSk5X6xs4ASofVP6eAhNMDYOLPKRbR35n1336aPJUJrVMp3L6rIvb0G/GhhjmAYRoTLp1Rrtl6GtJUSry03MXMqs8q++L19JO5O8u2HDpSkqNDZTNLD5XsIefjTAePlBvx08k7TYOWRXvYfc8KDsosE7z1yQC6DYcQAam6jvL+xtxLgO+4IMYEcdsD62g85olDKMPmdVNYARFzhnD+bnVk+UgIbyA3rNSi8OSN264gJZTmExztaH2HZR93PJkqsirBNXhMNthDxwQhvrwTV/eqzdQGrtj0Y1mpHO6Q7qMEhV5lr8UGax5JP1n6M+4YR5c8xupjd6a2YhY/NOD2dc8drMj9C5QFRa2LejwhCG+6lO6W6X60Cdw+gfVaosKHlul1ttJWn8UTsRrYqihHMYxpvk0JlauXXuEK41xJyuJ6zJXnAPEESYzU1K2FkdYjs3l4QrAtLLaNV5zoiGsaeQNr00tUo7TtUdsuewuv1A9QlskzbI61HmuHwthNSjVktXD2is/qSIXGusrsHtFp8kNfjqRcDjo60Qoj3jm2ZA2NPmPuORYGmxmw/vx7+g2mXm/mRhLNu22J+yebU=----ATTACHMENT:----NTIwMjg2OTM1NTU1MTk3NSAxMzc5MjIzMzQyMDM2MTA3IDM5OTYzNjEyNjUzNDg2NjE=