<?php

namespace Lensky\PerformanceBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PostRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PostRepository extends EntityRepository
{
    /**
     * Find all posts with authors
     *
     * @return array | Post[]
     */
    public function findAllPostsAndAuthors()
    {
        $qb = $this->createQueryBuilder('p');
        $qb->addSelect('a')
            ->innerJoin('p.author', 'a');

        return $qb->getQuery()->getResult();
    }

    /**
     * Update created date for all posts
     *
     * @param \DateTime $newCreatedAt
     *
     * @return int
     */
    public function updateCreatedAtForAllPosts(\DateTime $newCreatedAt)
    {
        $qb = $this->createQueryBuilder($this->alias);
        $qb->update()
            ->set('p.createdAt', ':newCreatedAt')
            ->setParameter('newCreatedAt', $newCreatedAt);

        return $qb->getQuery()->execute();
    }
}

<?php

namespace Lensky\PerformanceBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PostRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PostRepository extends EntityRepository
{
    /**
     * Find all posts with authors
     *
     * @return array | Post[]
     */
    public function findAllPostsAndAuthors()
    {
        $qb = $this->createQueryBuilder('p');
        $qb->addSelect('a')
            ->innerJoin('p.author', 'a');

        return $qb->getQuery()->getResult();
    }

    /**
     * Update created date for all posts
     *
     * @param \DateTime $newCreatedAt
     *
     * @return int
     */
    public function updateCreatedAtForAllPosts(\DateTime $newCreatedAt)
    {
        $qb = $this->createQueryBuilder('p');
        $qb->update()
            ->set('p.createdAt', ':newCreatedAt')
            ->setParameter('newCreatedAt', $newCreatedAt);

        return $qb->getQuery()->execute();
    }
}

Fix alias in update query
Fix alias in update query
