This service will trigger event with classifieds that needs activetion email to be resent.

@param int $limit
@return array with document ids
553910
public function activationEmailResend($limit = 10) 
    {
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$em = $main->getEntityManager();
		$cache = $this->getServiceLocator()->get('ClassifiedCache');
		$documentRepository = $main->getDocumentEntityRepository();
		$documents = $documentRepository->getClassifiedsThatNeedActivationEmailToBeResent($limit); 
        $url = $this->getServiceLocator()->get('ControllerPluginManager')->get('Url');
        
		$ids = array();
		foreach ($documents as $document) {
		    $url = $this->getServiceLocator()->get('ControllerPluginManager')->get('Url');
		    $classifiedModel = $this->getServiceLocator()->get('document.model.classifiedAdminListing');
		    $classifiedModel->init($document, $this->getServiceLocator());
		    $event = new ClassifiedCreatedEvent('save', null, array(
    		    'to' => $classifiedModel->email, 
    		    'siteurl' => $url->fromRoute('home', array(), array('force_canonical' => true)),
    		    'fullname' => $classifiedModel->fullname,
		        'title' => $classifiedModel->title, 
		        'hash' => $classifiedModel->hashId,
		        'state' => $classifiedModel->state
    		));
            
		    // Add 1 second to date edit
		    $dateInsert = $document->getDateInsert();
		    $interval = new \DateInterval('PT1S'); // 1 second
		    $newDateEdit = $dateInsert->add($interval);
			$document->setDateEdit($newDateEdit);
			$em->persist($document);
			$em->flush();

		    $ids[] = $document->getDocumentId();
		    $this->getEventManager()->trigger('classifiedCreated.post', $this, $event);
		}
		
		return $ids;
    }
962674
protected function getListLogOrder(array $limit)
    {
        $conditions = array(
            'limit' => $limit,
            'order_id' => $this->data_order['order_id']
        );

        return (array) $this->order_history->getList($conditions);
    }
679999
public function getJobs($limit = null)
    {
        $query = \Doctrine_Query::create($this->connection)
                ->from($this->jobModelName)
                ->where("$this->jobStatusColumn = ?", JobInterface::STATUS_ACTIVE)
                ->orderBy("$this->jobPriorityColumn DESC")
                ->addOrderBy("$this->jobDateLastRunColumn ASC");

        if (null !== $limit) {
            $query->limit($limit);
        }

        return $query->execute(array(), \Doctrine_Core::HYDRATE_RECORD);
    }
1283490
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $line) {
            if ($limit && $counter >= $limit) {
                return;
            }

            yield $line;
            ++$counter;
        }
    }
213056
public function limit($limit) : QueryBuilder
    {
        $this->_query[] = "LIMIT";

        if(is_array($limit)) {
            $this->_query[] = $this->getQuoted($limit[0]).",";
            $this->_query[] = $this->getQuoted($limit[1]);

            return $this;
        }

        $this->_query[] = $this->getQuoted($limit);

        return $this;
    }
343299
public function all($limit = null)
    {
        if($limit){
            return $this->model->limit($limit)->get();
        }

        return $this->model->all();
    }
630554
public function getQueryResults($limit = null)
    {
        if (isset($limit)) {
            $this->queryBuilder->setMaxResults($limit);
        }
        
        if (!$this->queryBuilder->getDQLPart('orderBy')) {
            $this->queryBuilder->orderBy('a.createdAt', 'ASC');
        }

        return $this->queryBuilder->getQuery()->getResult();
    }
959693
public function getContent($limit = 0)
    {
        return $this->getESAdaptor()->getDocuments($this->getRegistryIndex($this->section), $limit);
    }
982355
public function getItemsWithImportingStatus($limit)
    {
        $collection = $this->addFieldToFilter(
            'import_status',
            ['eq' => \Dotdigitalgroup\Email\Model\Importer::IMPORTING]
        )
            ->addFieldToFilter('import_id', ['neq' => ''])
            ->setPageSize($limit)
            ->setCurPage(1);

        if ($collection->getSize()) {
            return $collection;
        }

        return false;
    }
1267204
public function findLastCreated($limit = 5)
    {
        $query = $this->createQueryBuilder('c')
            ->orderBy('c.createdAt', 'DESC')
            ->setMaxResults($limit)
            ->getQuery();

        return $query->getResult();
    }
211162
public function limit($limit = null) {
		if (is_null($limit)) //remove options
			return $this->discard('query.limit');
	
		return $this->merge(['query.limit' => intval($limit)]);
	}
1106826
public function getPosts($limit = false, $offset = false)
    {
        if (!$limit) {
            $limit = Option::get('posts_per_page');
        }
        return Post::getByAuthor($this->ID, $limit, $offset);
    }
424826
public function getSitesFromIds($idSites, $limit = false)
    {
        if (count($idSites) === 0) {
            return array();
        }

        if ($limit) {
            $limit = "LIMIT " . (int)$limit;
        } else {
            $limit = '';
        }

        $idSites = array_map('intval', $idSites);

        $db    = $this->getDb();
        $sites = $db->fetchAll("SELECT * FROM " . $this->table . "
                                WHERE idsite IN (" . implode(", ", $idSites) . ")
                                ORDER BY idsite ASC $limit");

        return $sites;
    }
240253
public static function listFolder(string $dir, int $limit = 5000): array
    {
        $directory = [];
        if (file_exists($dir)) {
            $i = 0;
            foreach (scandir($dir) as $b):
                if ($b !== "." && $b !== ".." && $i < $limit):
                    $directory[] = $b;
                    $i++;
                endif;
            endforeach;
        }

        return $directory;
    }
1373656
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $row) {
            if ($limit && $counter >= $limit) {
                return;
            }

            yield trim($row['ua']);
            ++$counter;
        }
    }
630013
public function getIdsFromConditions($rows, $conditions, $limit = null)
    {
        $withLimit = !is_null($limit) && (is_array($limit) && !is_null($limit[0]));
        if ($withLimit) {
            $max = is_null($limit[1]) ? $limit[0] : ($limit[0] + $limit[1]);
        }

        $ids = array();
        foreach ($rows as $id => $row) {
            if ($id === '__ids__') {
                continue;
            }

            $valid = true;
            foreach ($conditions as $c) {
                if (!$this->isValid($row, $c)) {
                    $valid = false;
                    break;
                }
            }
            if ($valid === true) {
                $ids[] = $id;
                if ($withLimit && isset($max) && count($ids) > $max) {
                    break;
                }
            }
        }
        if ($withLimit) {
            if ($limit[1] === null) {
                $ids = array_slice($ids, 0, $limit[0]);
            } else {
                $ids = array_slice($ids, $limit[0], $limit[1]);
            }
        }

        return $ids;
    }
680340
public function selectAll($limit = 0)
	{
		$stmt = $this->pdo->prepare(<<<EOT
SELECT 
	t1.*,
	t2.ProjectId AS "Project.ProjectId",
	t2.Name AS "Project.Name",
	t2.Description AS "Project.Description",
	t2.Created AS "Project.Created"   
FROM `$this->tableName` AS t1 
LEFT JOIN Projects AS t2 ON t1.ProjectId = t2.ProjectId 
ORDER BY t1.Started DESC ;
EOT
		);
		$res = $stmt->execute();

		if ($res === false) {
			return array();
		}

		$rows = $stmt->fetchAll();

		$ret = array();
		foreach ($rows as $row) {
			array_push($ret, $this->prepareEntity($row));
		}

		return $ret;
	}