public function getEntityWithLowerPosition(Page $movedEntity) { $criteria = new SelectCriteria($this->getDomain()); $criteria->setCriteria(Criterion::_gt($this->getDomain(), "position", $movedEntity->getPosition())); $criteria->addTransformer(Transformer::_limit(1)); $criteria->addTransformer(Transformer::_orderBy($this->getDomain(), "position", false)); return $criteria->toUnique(); }
public function getEntityWithLowerPosition(PageComponent $movedEntity) { $criteria = new SelectCriteria($this->getDomain()); $positionCriteria = Criterion::_gt($this->getDomain(), "position", $movedEntity->getPosition()); $columnCriteria = Criterion::_eq($this->getDomain(), "pageColumnId", $movedEntity->getPageColumnId()); $criteria->setCriteria(Criterion::_and($positionCriteria, $columnCriteria)); $criteria->addTransformer(Transformer::_limit(1)); $criteria->addTransformer(Transformer::_orderBy($this->getDomain(), "position", false)); return $criteria->toUnique(); }
/** * @param $userToken * @return MoldPAuthToken */ private function getValidationTokenByToken($userToken) { $criteria = new SelectCriteria($this->getDomain()); $userTokenCriterion = Criterion::_eq($this->getDomain(), "userToken", $userToken); $lastActiveDate = Criterion::_gt($this->getDomain(), "lastActiveDate", $this->getDateTime("-2 hours")); $creationDate = Criterion::_gt($this->getDomain(), "creationDate", $this->getDateTime("-1 day")); $dateCriteria = Criterion::_or($lastActiveDate, $creationDate); $criteria->setCriteria(Criterion::_and($userTokenCriterion, $dateCriteria)); return $criteria->toUnique(); }
public function getResetTokenByUserId($userId, $token) { $criteria = new SelectCriteria($this->getDomain()); $userCriteria = Criterion::_eq($this->getDomain(), "userId", $userId); $tokenCriteria = Criterion::_eq($this->getDomain(), "token", $token); $creationDate = Criterion::_gt($this->getDomain(), "creationDate", $this->getDateTime("-1 day")); $tokenDetailsCriteria = Criterion::_and($userCriteria, $tokenCriteria); $criteria->setCriteria(Criterion::_and($tokenDetailsCriteria, $creationDate)); return $criteria->toUnique(); }