*
* @return array
*/
- public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC')
+ public function findEntries($userId, $isArchived = null, $isStarred = null, $sort = 'created', $order = 'ASC', $since = 0)
{
$qb = $this->createQueryBuilder('e')
->where('e.user =:userId')->setParameter('userId', $userId);
$qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred);
}
+ if ($since >= 0) {
+ $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
+ }
+
if ('created' === $sort) {
$qb->orderBy('e.id', $order);
} elseif ('updated' === $sort) {
->getQuery()
->getResult();
- $languages = array();
+ $languages = [];
foreach ($results as $result) {
$languages[$result['language']] = $result['language'];
}
* @param $url
* @param $userId
*
- * @return array|bool
+ * @return Entry|bool
*/
public function findByUrlAndUserId($url, $userId)
{
*
* @param int $userId
*
- * @return integer
+ * @return int
*/
public function countAllEntriesByUsername($userId)
{