original_string: 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;
  	}
code: 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;
  	}
code_tokens: 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 ; }
docstring: Get last version for a post
  
  @param integer $id AsfDocumentBundle:Page  ID
docstring_tokens: Get last version for a post