08-06-2023, 03:28 PM
I have a strange problem :
I have an application symfony 2.3 (with sonata user)
I created a bundle with one entity - the entity was created without a problem
then I had to modify the entity and now it seems to be impossible to modify the schema :
To see what happens I increased all the string lengths with +1
The entity code (with annotations) :
namespace Too\ConfigAppBundle\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
/**
* ConfigApp
*
* @ORM\Table(name="ConfigApp")
* @ORM\Entity(repositoryClass="Too\ConfigAppBundle\Entity\ActiviteRepository")
*/
class ConfigApp
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $nom
*
* @ORM\Column(name="nom", type="string", length=101, unique=true)
*/
private $nom;
/**
* @var string $nomSlug
*
* @Gedmo\Slug(fields={"nom"}, updatable=true, separator="_")
* @ORM\Column(name="nomSlug", type="string", length=101, nullable=true)
*/
private $nomSlug;
/**
* @var string $email
*
* @ORM\Column(name="email", type="string", length=151)
*/
private $email;
/**
* @var string $telephone
*
* @ORM\Column(name="telephone", type="string", length=16)
*/
private $telephone;
/**
* @var datetime $cree_le
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="cree_le", type="datetime")
*/
private $cree_le;
/**
* @var datetime $modifie_le
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(name="modifie_le", type="datetime")
*/
private $modifie_le;
...
Now see the result of :
php app/console doctrine:schema:update --dump-sql
CREATE TABLE ConfigApp (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(100) NOT NULL, nomSlug VARCHAR(100) NOT NULL, email VARCHAR(150) NOT NULL, telephone VARCHAR(15) NOT NULL, cree_le DATETIME NOT NULL, modifie_le DATETIME NOT NULL, PRIMARYKEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
None of the new length is taken in account :
for example the field nom should have length=101,
but the dump-sql gives nom VARCHAR(100) !
Could anyone try to figure out whats going wrong ?
Thanks !
EDIT :
I tried to clear the cache before with :
* php app/console doctrine:cache:clear-metadata
* php app/console cache:clear
* by deleting all content in cache folders
I also tried --dump-sql and --force.
This changes nothing at all.
Please any hint would be welcome !