diff --git a/hesabixCore/src/Controller/BusinessController.php b/hesabixCore/src/Controller/BusinessController.php index c781103..2987ae4 100644 --- a/hesabixCore/src/Controller/BusinessController.php +++ b/hesabixCore/src/Controller/BusinessController.php @@ -543,4 +543,12 @@ class BusinessController extends AbstractController ]; return $this->json($response); } + + #[Route('v2/api/settings/chack-api', name: 'api_business_check_api')] + public function api_business_check_api(Access $access,Log $log,Request $request,EntityManagerInterface $entityManager): Response + { + return $this->json([ + 'Success'=>true + ]); + } } diff --git a/hesabixCore/src/Entity/Business.php b/hesabixCore/src/Entity/Business.php index 4cfd723..0f048b8 100644 --- a/hesabixCore/src/Entity/Business.php +++ b/hesabixCore/src/Entity/Business.php @@ -199,6 +199,9 @@ class Business #[ORM\OneToMany(mappedBy: 'bid', targetEntity: Shareholder::class, orphanRemoval: true)] private Collection $shareholders; + #[ORM\OneToMany(mappedBy: 'bid', targetEntity: Hook::class, orphanRemoval: true)] + private Collection $hooks; + public function __construct() { $this->logs = new ArrayCollection(); @@ -223,6 +226,7 @@ class Business $this->archiveFiles = new ArrayCollection(); $this->archiveOrders = new ArrayCollection(); $this->shareholders = new ArrayCollection(); + $this->hooks = new ArrayCollection(); } public function getId(): ?int @@ -1321,4 +1325,34 @@ class Business return $this; } + + /** + * @return Collection + */ + public function getHooks(): Collection + { + return $this->hooks; + } + + public function addHook(Hook $hook): static + { + if (!$this->hooks->contains($hook)) { + $this->hooks->add($hook); + $hook->setBid($this); + } + + return $this; + } + + public function removeHook(Hook $hook): static + { + if ($this->hooks->removeElement($hook)) { + // set the owning side to null (unless already changed) + if ($hook->getBid() === $this) { + $hook->setBid(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Entity/Hook.php b/hesabixCore/src/Entity/Hook.php new file mode 100644 index 0000000..7ff3995 --- /dev/null +++ b/hesabixCore/src/Entity/Hook.php @@ -0,0 +1,83 @@ +id; + } + + public function getBid(): ?Business + { + return $this->bid; + } + + public function setBid(?Business $bid): static + { + $this->bid = $bid; + + return $this; + } + + public function getUrl(): ?string + { + return $this->url; + } + + public function setUrl(string $url): static + { + $this->url = $url; + + return $this; + } + + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(string $password): static + { + $this->password = $password; + + return $this; + } + + public function getSubmitter(): ?User + { + return $this->submitter; + } + + public function setSubmitter(?User $submitter): static + { + $this->submitter = $submitter; + + return $this; + } +} diff --git a/hesabixCore/src/Entity/User.php b/hesabixCore/src/Entity/User.php index 5f684f1..d37fad0 100644 --- a/hesabixCore/src/Entity/User.php +++ b/hesabixCore/src/Entity/User.php @@ -98,6 +98,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\OneToMany(mappedBy: 'submitter', targetEntity: ArchiveOrders::class, orphanRemoval: true)] private Collection $archiveOrders; + #[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Hook::class, orphanRemoval: true)] + private Collection $hooks; + public function __construct() { $this->userTokens = new ArrayCollection(); @@ -117,6 +120,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $this->storeroomTickets = new ArrayCollection(); $this->archiveFiles = new ArrayCollection(); $this->archiveOrders = new ArrayCollection(); + $this->hooks = new ArrayCollection(); } public function getId(): ?int @@ -770,4 +774,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + /** + * @return Collection + */ + public function getHooks(): Collection + { + return $this->hooks; + } + + public function addHook(Hook $hook): static + { + if (!$this->hooks->contains($hook)) { + $this->hooks->add($hook); + $hook->setSubmitter($this); + } + + return $this; + } + + public function removeHook(Hook $hook): static + { + if ($this->hooks->removeElement($hook)) { + // set the owning side to null (unless already changed) + if ($hook->getSubmitter() === $this) { + $hook->setSubmitter(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Repository/HookRepository.php b/hesabixCore/src/Repository/HookRepository.php new file mode 100644 index 0000000..9739ee2 --- /dev/null +++ b/hesabixCore/src/Repository/HookRepository.php @@ -0,0 +1,48 @@ + + * + * @method Hook|null find($id, $lockMode = null, $lockVersion = null) + * @method Hook|null findOneBy(array $criteria, array $orderBy = null) + * @method Hook[] findAll() + * @method Hook[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class HookRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Hook::class); + } + +// /** +// * @return Hook[] Returns an array of Hook objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('h') +// ->andWhere('h.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('h.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Hook +// { +// return $this->createQueryBuilder('h') +// ->andWhere('h.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +}