我创造了一个新的实体
php app/console generate:doctrine:entity当我想更新我的数据库时
php应用程序/控制台原则:模式:更新-转储-sql
我有这个错误
HP Fatal error: Access level to Minn\AdsBundle\Entity\CountryTranslation::$id must be protected (as in class ..我认为有一种与translation-bundle有关的关怀就在:
/NetBeansProjects/tuto/src/Minn/AdsBundle/Entity/CountryTranslation.php
我的朋友们!
发布于 2014-03-05 07:17:04
以下是如何定义CountryTranslation:
<?php
namespace Minn\AdsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
/**
* @ORM\Entity
* @ORM\Table(
* uniqueConstraints={@ORM\UniqueConstraint(name="lookup_unique_idx", columns={
* "locale", "object_id", "field"
* })}
* )
*/
class CountryTranslation extends AbstractPersonalTranslation {
/*
* Convenient constructor
*
* @param string $locale
* @param string $field
* @param string $value
*/
/*public function __construct($locale, $field, $value) {
$this->setLocale($locale);
$this->setField($field);
$this->setContent($value);
}*/
public function __construct() {
/*this must be an empty one!*/
}
/**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="translations")
* @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $object;
}发布于 2014-03-05 07:13:18
我的实体CountryTranslation :
<?php
namespace Minn\AdsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
/**
* @ORM\Entity
* @ORM\Table(
* uniqueConstraints={@ORM\UniqueConstraint(name="lookup_unique_idx", columns={
* "locale", "object_id", "field"
* })}
* )
*/
class CountryTranslation extends AbstractPersonalTranslation {
/*
* Convenient constructor
*
* @param string $locale
* @param string $field
* @param string $value
*/
/*public function __construct($locale, $field, $value) {
$this->setLocale($locale);
$this->setField($field);
$this->setContent($value);
}*/
public function __construct() {
/*this must be an empty one!*/
}
/**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="translations")
* @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $object;
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $locale;
/**
* @var string
*/
private $field;
/**
* @var string
*/
private $content;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set locale
*
* @param string $locale
* @return CountryTranslation
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Set field
*
* @param string $field
* @return CountryTranslation
*/
public function setField($field)
{
$this->field = $field;
return $this;
}
/**
* Get field
*
* @return string
*/
public function getField()
{
return $this->field;
}
/**
* Set content
*
* @param string $content
* @return CountryTranslation
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set object
*
* @param \Minn\AdsBundle\Entity\Country $object
* @return CountryTranslation
*/
public function setObject(\Minn\AdsBundle\Entity\Country $object = null)
{
$this->object = $object;
return $this;
}
/**
* Get object
*
* @return \Minn\AdsBundle\Entity\Country
*/
public function getObject()
{
return $this->object;
}}
https://stackoverflow.com/questions/22184626
复制相似问题