Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown column type "int" requested

i am back with another symfony problem.

code:

    <?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;
    }
}

Tried swtiching from double apostrophe to single, everything is built according to the symfony rules, all types are lowercase. Yet another problem i can't seem to find its solution.

like image 886
Pencho Slaveikov Avatar asked Aug 04 '15 15:08

Pencho Slaveikov


2 Answers

Replace type="int" by type="integer"

like image 84
PokeRwOw Avatar answered Nov 05 '22 01:11

PokeRwOw


Take a look at the Doctrine2 Column type definition here:

http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#doctrine-mapping-types

Replace int with integer, as example:

   /**
     * @ORM\Column(name="currency", type="integer", length=5)
     */
    protected $currency;
like image 4
Matteo Avatar answered Nov 05 '22 00:11

Matteo