I have an error when I am trying to run doctrine:generate:entities
:
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] Couldn't find constant ?, property Smartnode\TalkBundle\Entity\Post::$postowner.
This is my post entity class:
namespace Smartnode\TalkBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Post
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Smartnode\TalkBundle\Entity\PostRepository")
*/
class Post
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var integer
*
* @ORM\ManyToOne(targetEntity=“Smartnode\userBundle\Entity\User“)
* @JoinColumn(name="postowner_id", referencedColumnName="id")
*/
protected $postowner;
/**
* @var integer
*
* @ORM\ManyTonOne(targetEntity=“Smartnode\TalkBundle\Entity\Chan“)
*/
private $postchan;
/**
* @var \DateTime
*
* @ORM\Column(name="creationdate", type="datetime")
*/
private $creationdate;
And this is my User entity class:
namespace Smartnode\userBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="Smartnode\userBundle\Entity\UserRepository")
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
The probleme Was the quote :/
with the good quote all is working
Thanks All for help
The answer of the question creator is correct. Anyways it is unclear, what he means by the problem was the quote.
Also ' should be used instead of a " to quote the values of the annotation attributes.
The issue for me was, that a quote was missing.
Wrong code:
/**
* @ORM\OneToMany(targetEntity="UnternehmenBrancheZuordnung", mappedBy=_unternehmen")
* @var ArrayCollection $_branchenZuordnungen
*/
private $_branchenZuordnungen;
Right code:
/**
* @ORM\OneToMany(targetEntity="UnternehmenBrancheZuordnung", mappedBy="_unternehmen")
* @var ArrayCollection $_branchenZuordnungen
*/
private $_branchenZuordnungen;
Here the missing quote is highlighted: mappedBy="
_unternehmen"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With