DevSquid
DevSquid

Reputation: 35

Doctrine fails to update schema. "Nothing to update" (Symfony 3.4.8)

I've recently created an Entity with php bin/console doctorine:generate:entity. After creation, I've tried to update my schema with php bin/console doctrine:schema:update --force but got an output of:

Nothing to update - your database is already in sync with the current entity metadata.

Things I've already tried:

Same output

Ran, but nothing changed

Nothing

output: [OK] FOS\UserBundle\Model\Group [OK] FOS\UserBundle\Model\User

Entity in question:


namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="WeeklyPaymentReport")
 */
class WeeklyPaymentReport
{
    /**
     * @var int
     * 
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var int
     * 
     * @ORM\Column(type="integer", nullable=true)
     */
    private $bbid;

    /**
     * @var String
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $request;

    /**
     * @var \DateTime
     * 
     * @ORM\Column(name="dateOfBirth", type="date", nullable=true)
     */
    private $date;


    
    public function getId()
    {
        return $this->id;
    }

    
    public function setBbid($bbid)
    {
        $this->bbid = $bbid;

        return $this;
    }

    
    public function getBbid()
    {
        return $this->bbid;
    }

    
    public function setRequest($request)
    {
        $this->request = $request;

        return $this;
    }

    
    public function getRequest()
    {
        return $this->request;
    }

    
    public function setDate($date)
    {
        $this->date = $date;

        return $this;
    }

    
    public function getDate()
    {
        return $this->date;
    }
}

Doctrine also generated:


namespace AppBundle\Repository;

/**
 * WeeklyPaymentReportRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class WeeklyPaymentReportRepository extends \Doctrine\ORM\EntityRepository
{
}

And also .orm.php for it:


use Doctrine\ORM\Mapping\ClassMetadataInfo;

$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->customRepositoryClassName = 'AppBundle\Repository\WeeklyPaymentReportRepository';
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->mapField(array(
   'fieldName' => 'id',
   'type' => 'integer',
   'id' => true,
   'columnName' => 'id',
  ));
$metadata->mapField(array(
   'columnName' => 'bbid',
   'fieldName' => 'bbid',
   'type' => 'integer',
  ));
$metadata->mapField(array(
   'columnName' => 'request',
   'fieldName' => 'request',
   'type' => 'string',
   'length' => 255,
  ));
$metadata->mapField(array(
   'columnName' => 'date',
   'fieldName' => 'date',
   'type' => 'datetime',
  ));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); 

What else can I try?

Thank you for your help in advance!

Upvotes: 1

Views: 1153

Answers (1)

DevSquid
DevSquid

Reputation: 35

Okay, so right after posting, I've found a post i've never been recommended before which solved the problem.

It's the last sentence, that solved my case.

"After deleting John.orm.php file if i run php bin/console doctrine:schema:update --force then it will generate tables."

Kinda weird solution, I hope I dont encounter weird anomalies in future developments because of it.

Upvotes: 1

Related Questions