注解 "@Doctrine\ORM\Mapping\column":$status 不存在,或无法自动加载
The annotation "@Doctrine\ORM\Mapping\column":$status does not exist, or could not be auto-loaded
[语义错误] 属性 AppBundle\Entity\Product::$status 中的注释“@Doctrine\ORM\Mapping\column”不存在,或无法自动加载。
这是错误
我正在使用 symfony 3.4
................................................ ..................................................... ..................................................... ...............
这是实体
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Product
*/
class Product
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $productname;
/**
* @var string
* @ORM\column(name="status",type="string",length=255)
*/
private $status;
/**
* @var string
*/
private $specification;
/**
* @var int
*/
private $phone;
/**
* @var int
*/
private $price;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set productname
*
* @param string $productname
*
* @return Product
*/
public function setProductname($productname)
{
$this->productname = $productname;
return $this;
}
/**
* Get productname
*
* @return string
*/
public function getProductname()
{
return $this->productname;
}
/**
* Set specification
*
* @param string $specification
*
* @return Product
*/
public function setSpecification($specification)
{
$this->specification = $specification;
return $this;
}
/**
* Get specification
*
* @return string
*/
public function getSpecification()
{
return $this->specification;
}
/**
* Set phone
*
* @param integer $phone
*
* @return Product
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return int
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set price
*
* @param integer $price
*
* @return Product
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get price
*
* @return int
*/
public function getPrice()
{
return $this->price;
}
/**
* Set status
*
* @param string $status
*
* @return Product
*/
public function setStatus($status)
{
$this->status = $status;
return $this->status;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
}
我搞错了。
在
public function setStatus()
制作return $this->status;
至 return $this;
和
移除
@Orm\column(name='status',type='string,length=255')
[语义错误] 属性 AppBundle\Entity\Product::$status 中的注释“@Doctrine\ORM\Mapping\column”不存在,或无法自动加载。
这是错误 我正在使用 symfony 3.4
................................................ ..................................................... ..................................................... ...............
这是实体
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Product
*/
class Product
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $productname;
/**
* @var string
* @ORM\column(name="status",type="string",length=255)
*/
private $status;
/**
* @var string
*/
private $specification;
/**
* @var int
*/
private $phone;
/**
* @var int
*/
private $price;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set productname
*
* @param string $productname
*
* @return Product
*/
public function setProductname($productname)
{
$this->productname = $productname;
return $this;
}
/**
* Get productname
*
* @return string
*/
public function getProductname()
{
return $this->productname;
}
/**
* Set specification
*
* @param string $specification
*
* @return Product
*/
public function setSpecification($specification)
{
$this->specification = $specification;
return $this;
}
/**
* Get specification
*
* @return string
*/
public function getSpecification()
{
return $this->specification;
}
/**
* Set phone
*
* @param integer $phone
*
* @return Product
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return int
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set price
*
* @param integer $price
*
* @return Product
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get price
*
* @return int
*/
public function getPrice()
{
return $this->price;
}
/**
* Set status
*
* @param string $status
*
* @return Product
*/
public function setStatus($status)
{
$this->status = $status;
return $this->status;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
}
我搞错了。 在
public function setStatus()
制作return $this->status;
至 return $this;
和
移除
@Orm\column(name='status',type='string,length=255')