symfony - 数据库中缺少属性
问题描述
当我使用:s 学说:模式:更新 - 强制在我的数据库中创建我的表时,我只得到 id 属性,其他都没有
S 学说:数据库:创建 s 学说:生成:form ClubBundle:Club 我没有接触过我使用过的实体 Club.php 文件我在表中获得的唯一属性只有 id!
<?php
namespace ClubBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Club
*
* @ORM\Table(name="club")
* @ORM\Entity(repositoryClass="ClubBundle\Repository\ClubRepository")
*/
class Club
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* @var string
*
* @ORM\Column(name="description", type="string", length=255)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="adresse", type="string", length=255)
*/
private $adresse;
/**
* @var string
*
* @ORM\Column(name="domaine", type="string", length=255)
*/
private $domaine;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set nom
*
* @param string $nom
*
* @return Club
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set description
*
* @param string $description
*
* @return Club
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set adresse
*
* @param string $adresse
*
* @return Club
*/
public function setAdresse($adresse)
{
$this->adresse = $adresse;
return $this;
}
/**
* Get adresse
*
* @return string
*/
public function getAdresse()
{
return $this->adresse;
}
/**
* Set domaine
*
* @param string $domaine
*
* @return Club
*/
public function setDomaine($domaine)
{
$this->domaine = $domaine;
return $this;
}
/**
* Get domaine
*
* @return string
*/
public function getDomaine()
{
return $this->domaine;
}
}
解决方案
尝试
php bin/console cache:clear
和这个:
php bin/console doctrine:schema:update --complete --force
或者
php bin/console doctrine:schema:update --force
如果你使用 symfony 4 试试这个
php bin/console make:migration
那么这个
php bin/console doctrine:migrations:migrate
推荐阅读
- webpack - 为什么 webpack 在 'graceful-fs' 中的 'fs' 遇到问题?
- bash - 使用 wget 通过重定向 POST 表单登录凭据
- grpc - Envoy 代理不会将我的 gRPC 请求转换为 HTTP1.1 请求 - 使用反向过滤桥
- javascript - 从平面列表中删除项目
- google-chrome-extension - Chrome 扩展清单 V3 远程托管代码
- java - 春天的依赖不满足
- performance - Apache Ignite CollisionSpi 配置
- c# - 如何初始化 vhdx 并格式化以将内容复制到新驱动器
- uwp - 带圆角的内容对话框 [UWP Win10 Build 1904*]
- algorithm - 系统搜索算法时间复杂度