router=$router; $this->formFactory=$formFactory; } /** * @param Grid[] $grid * @param Worldmark[] $worldmarks * @param float $version * @param bool $includeDeleted * @return Node[] */ public function getGridNodes(array $grid, array $worldmarks, float $version, bool $includeDeleted = false): array { $qb=$this->_em->createQueryBuilder(); $qb->select("node") ->from(Node::class, "node") ->andWhere($qb->expr()->in("node.grid", ":param_inGridId")) ->andWhere($qb->expr()->in("node.worldmark", ":param_inWorldmarkId")) ->andWhere($qb->expr()->lte("node.version", ":param_version")) ->orderBy("node.grid"); $qb->setParameters(array( 'param_inGridId' => $grid, 'param_inWorldmarkId' => $worldmarks, 'param_version' => $version, )); if(!$includeDeleted) { $qb->andWhere($qb->expr()->eq("node.isDeleted", 0)); } return $qb->getQuery()->getResult(); } public function getForm(string $route, Grid $grid, Worldmark $worldmark, Node $node): FormInterface { $params=$node->getId() !== null ? array( 'gridId'=>$grid->getId(), 'worldmarkId'=>$worldmark->getId(), 'id'=>$node->getId(), ) : array( 'gridId'=>$grid->getId(), 'worldmarkId'=>$worldmark->getId(), ); return $this->formFactory->create(NodeType::class, $node, array( 'action'=>$this->router->generate($route, $params), 'method'=>'post', 'data_route'=>$route, )); } }