/** * @param Selection $context * @param $token * @param string $via [optional] * @return \Nette\Database\Table\Selection */ public function filterValid(Selection $context, $token, $via = '') { $nFilter = $this->filterFactory->createN($context); $nFilter->setup('token', $token)->via($via); $nFilter->setup('valid_to', new SqlLiteral('DATE(NOW())'))->via($via)->operator('>='); return $nFilter->build(); }
/** * @param Selection $context * @param int $sectionId * @param string $via [optional] * @return Selection */ public function filterSection(Selection $context, $sectionId, $via = '') { $context->alias($this->sectionTableName, 'alternate_section'); $filterFactory = new Filter\Factory($this->sectionTableName); $nFilter = $filterFactory->createN($context); $nFilter->setup('id', $sectionId)->via("{$via}:page_has_section"); $nFilter->setup('id', $sectionId, 'alternate_section')->via($via); return $nFilter->build(); }