I've searched the internet for a whole day but still no solution. I notice a lot of people have experienced this issue but there's no specific answer so here's my scenario:
I'm using FOSUserBundle on Symfony 3 and i created my "User Entity" in AppBundle\Entity\User
. I made some corrections to some annotations in "User.php" file and tried to update doctrine using this command: php bin/console doctrine:schema:update --force
.
I got the message "Nothing to update - your database is already in sync with the current entity metadata.". I also tried php bin/console doctrine:schema:update --force --complete
and php bin/console doctrine:schema:update --dump-sql
and got the same message above.
I cleared my cache using several commands: php bin/console doctrine:cache:clear-metadata
, bin/console cache:clear --env=dev
, bin/console cache:clear
and tried updating again but still got the same message.
My entity User.php:
<?php
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table (name = "fos_user")
*/
Class User extends BaseUser{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string")
* @Assert\Length(min=2, max=50)
*/
protected $firstName;
/**
* @ORM\Column(type="string")
* @Assert\Length(min=2, max=50)
*/
protected $lastName;
Also i have added the entity in AppKernel.php (and fosuserbundle too) like this
new AppBundle\AppBundle(),
new FOS\UserBundle\FOSUserBundle(),
Please What could be causing doctrine not to update the DB?.
Thanks