Exemplo n.º 1
0
 /**
  * @param $pageRow PageRow
  * @return PageRowDto
  */
 public function mapPageRowToDto(PageRow $pageRow)
 {
     $pageRowDto = new PageRowDto();
     $pageRowDto->setId($pageRow->getId());
     $pageRowDto->setColumns($this->pageColumnMapper->mapPageColumnListToDto($pageRow->getColumns()));
     $pageRowDto->setPageId($pageRow->getPageId());
     $pageRowDto->setPosition($pageRow->getPosition());
     return $pageRowDto;
 }
Exemplo n.º 2
0
 public function getEntityWithLowerPosition(PageRow $movedEntity)
 {
     $criteria = new SelectCriteria($this->getDomain());
     $positionCriteria = Criterion::_gt($this->getDomain(), "position", $movedEntity->getPosition());
     $pageCriteria = Criterion::_eq($this->getDomain(), "pageId", $movedEntity->getPageId());
     $criteria->setCriteria(Criterion::_and($positionCriteria, $pageCriteria));
     $criteria->addTransformer(Transformer::_limit(1));
     $criteria->addTransformer(Transformer::_orderBy($this->getDomain(), "position", false));
     return $criteria->toUnique();
 }
Exemplo n.º 3
0
 private function swapPageRowPositions(PageRow $firstRow, PageRow $secondRow)
 {
     $firstRow->setPosition($firstRow->getPosition() + $secondRow->getPosition());
     $secondRow->setPosition($firstRow->getPosition() - $secondRow->getPosition());
     $firstRow->setPosition($firstRow->getPosition() - $secondRow->getPosition());
     $this->pageRowDao->update($firstRow);
     $this->pageRowDao->update($secondRow);
 }