Repository/PostRepository.php
public function getAllLastVersion()
	{
		$qb = $this->createQueryBuilder('p');
		$qb->where('p.original IS NULL AND p.state=:state')
			->setParameter(':state', DocumentModel::STATE_PUBLISHED);
		
		$result = $qb->getQuery()->getResult();
		$return = array();
		foreach($result as $original) {
			$return[] = $this->getLastVersion($original->getId());
		}
		return $return;
	}
public function getAllLastVersion()
	{
		$qb = $this->createQueryBuilder('p');
		$qb->where('p.original IS NULL AND p.state=:state')
			->setParameter(':state', DocumentModel::STATE_PUBLISHED);
		
		$result = $qb->getQuery()->getResult();
		$return = array();
		foreach($result as $original) {
			$return[] = $this->getLastVersion($original->getId());
		}
		return $return;
	}
public function getAllLastVersion ( ) { $ qb = $ this -> createQueryBuilder ( 'p' ) ; $ qb -> where ( 'p.original IS NULL AND p.state=:state' ) -> setParameter ( ':state' , DocumentModel :: STATE_PUBLISHED ) ; $ result = $ qb -> getQuery ( ) -> getResult ( ) ; $ return = array ( ) ; foreach ( $ result as $ original ) { $ return [ ] = $ this -> getLastVersion ( $ original -> getId ( ) ) ; } return $ return ; }
Get all posts in their last version
Get all posts in their last version