私は次のようなクラス設定を定義しました:
<?php
use Doctrine\ORM\Mapping as ORM;
/** @ORM\Entity */
class Setting {
/** @ORM\Column(type="integer")
* @ORM\GeneratedValue
* @ORM\id
*/
private $id;
/** @ORM\Column(length=255, nullable=true) */
private $displayname;
/** @ORM\Column(length=255) */
private $name;
/** @ORM\Column(type="text") */
private $value;
public function __get($name) {
return $this->$name;
}
public function __set($key, $value){
$this->$key = $value;
}
public function getFullName() {
return $this->name . ' suffix';
}
public static function getValue($settingName) {
$result = '';
try {
$setting = em()->createQuery('SELECT s FROM Setting s WHERE s.name = :name')
->setParameter('name', $settingName)
->getSingleResult();
$result = $setting->value;
}
catch (\Doctrine\ORM\NoResultException $exception) {
}
return $result;
}
}
残念ながら、これによりエラーが発生します致命的なエラー:Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class "Setting" is not a valid entity or mapped super class.' in xxxxx/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php on line 216
これはどのように解決できますか?