public function getLastVersion($post_id)
	{
		$qb = $this->createQueryBuilder('p');
		
		$qb->where('p.original=:post_id')
			->orderBy('p.createdAt', 'DESC')
			->setParameter(':post_id', $post_id);
		
		$result = $qb->getQuery()->setMaxResults(1)->getResult(Query::HYDRATE_OBJECT);
		
		if ( is_null($result) ) {
			$qb2 = $this->createQueryBuilder('p');
			$qb2->where('p.id=:post_id')->setParameter(':post_id', $post_id);
			
			$result = $qb->getQuery()->getResult(Query::HYDRATE_OBJECT);
		}
		
		return $result;
	}
public function getLastVersion($post_id)
	{
		$qb = $this->createQueryBuilder('p');
		
		$qb->where('p.original=:post_id')
			->orderBy('p.createdAt', 'DESC')
			->setParameter(':post_id', $post_id);
		
		$result = $qb->getQuery()->setMaxResults(1)->getResult(Query::HYDRATE_OBJECT);
		
		if ( is_null($result) ) {
			$qb2 = $this->createQueryBuilder('p');
			$qb2->where('p.id=:post_id')->setParameter(':post_id', $post_id);
			
			$result = $qb->getQuery()->getResult(Query::HYDRATE_OBJECT);
		}
		
		return $result;
	}
public function getLastVersion ( $ post_id ) { $ qb = $ this -> createQueryBuilder ( 'p' ) ; $ qb -> where ( 'p.original=:post_id' ) -> orderBy ( 'p.createdAt' , 'DESC' ) -> setParameter ( ':post_id' , $ post_id ) ; $ result = $ qb -> getQuery ( ) -> setMaxResults ( 1 ) -> getResult ( Query :: HYDRATE_OBJECT ) ; if ( is_null ( $ result ) ) { $ qb2 = $ this -> createQueryBuilder ( 'p' ) ; $ qb2 -> where ( 'p.id=:post_id' ) -> setParameter ( ':post_id' , $ post_id ) ; $ result = $ qb -> getQuery ( ) -> getResult ( Query :: HYDRATE_OBJECT ) ; } return $ result ; }
Get last version for a post

@param integer $id AsfDocumentBundle:Page  ID
Get last version for a post