0
votes

i am trying to create entity via cli. When i try to cretate getter/setter via console it gives this error: Doctrin\ORM\Mapping\MappingException

Class SfTuts\JobeetBundle\Entity\Job is not valid entity or mapped super class

Here is my code:

<?php

            namespace SfTuts\JobeetBundle\Entity;

            use Doctrine\ORM\Mapping as ORM;

            /**
             * @ORM\Entity
             * @ORM\Table(name="job")
             */
            class Job
            {
                /**
                 * @ORM\Id @Column(type="integer")
                 * @ORM\GeneratedValue
                 */
                protected $id;
            }

How can i solve this problem? Where is my fault? Thanks.

1

1 Answers

0
votes

Check do you have this option in your config.yml file

doctrine:
    orm:
        auto_mapping: true

Also your column declaration is wrong. It should be @ORM\Column not @Column becouse you are using Doctrine\ORM\Mapping namespace for annotations, not SfTuts\JobeetBundle\Entity

        namespace SfTuts\JobeetBundle\Entity;

        use Doctrine\ORM\Mapping as ORM;

        /**
         * @ORM\Entity
         * @ORM\Table(name="job")
         */
        class Job
        {
            /**
             * @ORM\Id 
             * @ORM\Column(type="integer")
             * @ORM\GeneratedValue
             */
            protected $id;
        }