symfony - 请求未知列类型 "int"

标签 symfony doctrine-orm

我又遇到了另一个 symfony 问题。

代码:

    <?php
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\EntityManager;
/**
 * @ORM\Entity
 * @ORM\Table(name="accounts")
 * @UniqueEntity("email", message="Email is already in use")
 * @UniqueEntity("alias", message="Alias is already in use")
 */
class User
{
    /**
     * @ORM\Id
     * @ORM\Column(name="id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(name="email", type="string", length=256, unique=true)
     * @Assert\NotBlank()
     * @Assert\Email()
     */
    protected $email;

    /**
     * @ORM\Column(name="alias", type="string", length=32)
     * @Assert\NotBlank()
     * @Assert\Length(min=3, max=32, minMessage="Alias must be at least 3 symbols", maxMessage="Alias cannot be longer than 32 symbols")
     */
    protected $alias;

    /**
     * @ORM\Column(name="password", type="string", length=256)
     * @Assert\NotBlank()
     * @Assert\Length(min=3,max=256, minMessage="Password must be at least 3 symbols", maxMessage="Password cannot be longer than 256 symbols")
     */
    protected $password;

    /**
    * @ORM\Column(name="created_at", type="datetime")
    */
    protected $created_at;

    /**
     * @ORM\Column(name="updated_at", type="datetime")
     */
    protected $updated_at;

    /**
     * @ORM\Column(name="currency", type="int", length=5)
     */
    protected $currency;

    /**
     * @ORM\Column(name="alternative_currency", type="int", length=5)
     */
    protected $alternative_currency;

    /**
     * @ORM\Column(name="level", type="int", length=2)
     */
    protected $level;

    /**
     * @ORM\Column(name="exp", type="int", length=10)
     */
    protected $exp;

    /**
     * @ORM\Column(name="activation_code", type="string", length=10)
     */
    protected $activation_code;

    /**
     * @ORM\Column(name="recovery_key", type="string", length=10)
     */
    protected $recovery_key;

    /**
     * @ORM\Column(name="recovery_time", type="datetime")
     */
    protected $recovery_time;

    /**
     * @ORM\Column(name="tutorial", type="int", length=1)
     */
    protected $tutorial;

    /**
     * @ORM\Column(name="last_zone", type="int", length=1)
     */
    protected $last_zone;

    /**
     * @ORM\Column(name="chat_status", type="int", length=1)
     */
    protected $chat_status;

    protected $remember_me;

    protected $em;



    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return User
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string 
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set alias
     *
     * @param string $alias
     * @return User
     */
    public function setAlias($alias)
    {
        $this->alias = $alias;

        return $this;
    }

    /**
     * Get alias
     *
     * @return string 
     */
    public function getAlias()
    {
        return $this->alias;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return User
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string 
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set created_at
     *
     * @param \DateTime $createdAt
     * @return User
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;

        return $this;
    }

    /**
     * Get created_at
     *
     * @return \DateTime 
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * Set updated_at
     *
     * @param \DateTime $updatedAt
     * @return User
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;

        return $this;
    }

    /**
     * Get updated_at
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

    /**
     * Set currency
     *
     * @param \int $currency
     * @return User
     */
    public function setCurrency(\int $currency)
    {
        $this->currency = $currency;

        return $this;
    }

    /**
     * Get currency
     *
     * @return \int 
     */
    public function getCurrency()
    {
        return $this->currency;
    }

    /**
     * Set alternative_currency
     *
     * @param \int $alternativeCurrency
     * @return User
     */
    public function setAlternativeCurrency(\int $alternativeCurrency)
    {
        $this->alternative_currency = $alternativeCurrency;

        return $this;
    }

    /**
     * Get alternative_currency
     *
     * @return \int 
     */
    public function getAlternativeCurrency()
    {
        return $this->alternative_currency;
    }

    /**
     * Set level
     *
     * @param \int $level
     * @return User
     */
    public function setLevel(\int $level)
    {
        $this->level = $level;

        return $this;
    }

    /**
     * Get level
     *
     * @return \int 
     */
    public function getLevel()
    {
        return $this->level;
    }

    /**
     * Set exp
     *
     * @param \int $exp
     * @return User
     */
    public function setExp(\int $exp)
    {
        $this->exp = $exp;

        return $this;
    }

    /**
     * Get exp
     *
     * @return \int 
     */
    public function getExp()
    {
        return $this->exp;
    }

    /**
     * Set activation_code
     *
     * @param string $activationCode
     * @return User
     */
    public function setActivationCode($activationCode)
    {
        $this->activation_code = $activationCode;

        return $this;
    }

    /**
     * Get activation_code
     *
     * @return string 
     */
    public function getActivationCode()
    {
        return $this->activation_code;
    }

    /**
     * Set recovery_key
     *
     * @param string $recoveryKey
     * @return User
     */
    public function setRecoveryKey($recoveryKey)
    {
        $this->recovery_key = $recoveryKey;

        return $this;
    }

    /**
     * Get recovery_key
     *
     * @return string 
     */
    public function getRecoveryKey()
    {
        return $this->recovery_key;
    }

    /**
     * Set recovery_time
     *
     * @param \DateTime $recoveryTime
     * @return User
     */
    public function setRecoveryTime($recoveryTime)
    {
        $this->recovery_time = $recoveryTime;

        return $this;
    }

    /**
     * Get recovery_time
     *
     * @return \DateTime 
     */
    public function getRecoveryTime()
    {
        return $this->recovery_time;
    }

    /**
     * Set tutorial
     *
     * @param \int $tutorial
     * @return User
     */
    public function setTutorial(\int $tutorial)
    {
        $this->tutorial = $tutorial;

        return $this;
    }

    /**
     * Get tutorial
     *
     * @return \int 
     */
    public function getTutorial()
    {
        return $this->tutorial;
    }

    /**
     * Set last_zone
     *
     * @param \int $lastZone
     * @return User
     */
    public function setLastZone(\int $lastZone)
    {
        $this->last_zone = $lastZone;

        return $this;
    }

    /**
     * Get last_zone
     *
     * @return \int 
     */
    public function getLastZone()
    {
        return $this->last_zone;
    }

    /**
     * Set chat_status
     *
     * @param \int $chatStatus
     * @return User
     */
    public function setChatStatus(\int $chatStatus)
    {
        $this->chat_status = $chatStatus;

        return $this;
    }

    /**
     * Get chat_status
     *
     * @return \int 
     */
    public function getChatStatus()
    {
        return $this->chat_status;
    }
}

尝试从双撇号切换到单撇号,一切都是根据symfony规则构建的,所有类型都是小写的。 还有一个问题我似乎找不到解决方案。

最佳答案

type="int" 替换为 type="integer"

关于symfony - 请求未知列类型 "int",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31813415/

相关文章:

command-line-interface - 为什么 Doctrine 2 创建 ~Entity.php 文件?

php - 在 Sylius 中使用自定义模板及其 ResourceBundle 来创建新实体

symfony - 使用带有 twitter Bootstrap 和 Assets 的图标

php - 如何在 monolog symfony2 日志记录中禁用 security.info 和 security.debug

php - Wkhtmltopdf 重定向到 symfony2 中的登录页面

php - Symfony 编码标准在类型转换后是否需要保留空间?

symfony - persistAndFlush 和 persist、flush 之间的区别

php - postUpdate 和 postPersist 在学说上的区别

php - 左连接 ON 条件和 Doctrine 中的其他条件语法

php - 学说 2 删除父行