title: Symfony Error: Neither the property nor one of the methods exist and have public access in class
body: <p>I use symfony 3.4.
  I create create,delete,edit,show pages for my Project table ..but i get this error when try show one project
  <code>Neither the property "fee" nor one of the methods "fee()", "getfee()"/"isfee()" or "__call()" exist and have public access in class "AppBundle\Entity\Project".</code></p>
  
  <p>My entity class(/Entity/Project.php)</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  namespace AppBundle\Entity;
  
  use Doctrine\Common\Collections\ArrayCollection;
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="project")
   * @ORM\Entity(repositoryClass="AppBundle\Repository\ProjectRepository")
   */
  class Project
  {
      /**
       * @ORM\Column(type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       * @ORM\OneToMany(targetEntity="AppBundle\Entity\Payment", mappedBy="id")
       * @ORM\OneToMany(targetEntity="AppBundle\Entity\Conversation", mappedBy="id")
       * @ORM\OneToMany(targetEntity="AppBundle\Entity\Attachment", mappedBy="id")
       */
      private $id;
  
      /**
       * @ORM\Column(type="string", length=100)
       * @Assert\NotBlank(message="please fill title")
       * @Assert\Length(min=3,minMessage="message from annotation: field must be at least 3")
       */
      private $title;
  
      /**
       * @ORM\Column(type="string", length=100)
       * @Assert\NotBlank(message="please fill type")
       */
      private $type;
  
      /**
       * @ORM\Column(type="integer")
       * @Assert\NotBlank(message="please fill budget")
       */
      private $budget;
  
      /**
       * @ORM\Column(type="text")
       */
      private $description;
  
      /**
       * @ORM\Column(type="datetime")
       * @Assert\DateTime
       */
      private $registerDate;
  
      /**
       * @ORM\Column(type="datetime")
       * @Assert\DateTime
       */
      private $endDate;
  
      /**
       * @ORM\Column(type="integer")
       */
      private $prePay;
      /**
       * @ORM\Column(type="integer")
       */
      private $fee;
      /**
       * @ORM\Column(type="integer", length=1)
       */
      private $isPay;
      /**
       * @ORM\Column(type="integer", length=1)
       */
      private $isPrePay;
      /**
       * @ORM\Column(name="attachmentId", type="string")
       *
       * @Assert\NotBlank(message="Please, upload the product brochure as a PDF file.")
       * @Assert\File(mimeTypes={ "application/zip" })
       */
      private $attachmentId;
      /**
       * @ORM\Column(type="smallint")
       */
      private $status;
      /**
       * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User")
       * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
       */
      private $user;
  
      public function __construct()
      {
          $this-&gt;registerDate = new \DateTime();
          $this-&gt;prePay = 0;
          $this-&gt;fee = 0;
          $this-&gt;isPay = 0;
          $this-&gt;isPrePay = 0;
          $this-&gt;status = 0; //@todo make this better 
      }
      public function getId()
      {
          return $this-&gt;id;
      }
  
      public function setId($id)
      {
          $this-&gt;id = $id;
      }
  
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      public function setTitle($title)
      {
          $this-&gt;title = $title;
      }
  
      public function getType()
      {
          return $this-&gt;type;
      }
  
      public function setType($type)
      {
          $this-&gt;type = $type;
      }
  
      public function getBudget()
      {
          return $this-&gt;budget;
      }
  
      public function setBudget($budget)
      {
          $this-&gt;budget = $budget;
      }
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      public function setDescription($description)
      {
          $this-&gt;description = $description;
      }
  
      public function getRegisterDate()
      {
          return $this-&gt;registerDate;
      }
  
      public function setRegisterDate($register_date)
      {
          $this-&gt;registerDate = $register_date;
      }
  
      public function getEndDate()
      {
          return $this-&gt;endDate;
      }
  
      public function setEndDate($end_date)
      {
          $this-&gt;endDate = $end_date;
      }
  
      public function getPrePay()
      {
          return $this-&gt;prePay;
      }
  
      public function setPrePay($pre_pay)
      {
          $this-&gt;prePay = $pre_pay;
      }
  
      public function geFee()
      {
          return $this-&gt;fee;
      }
  
      public function setFee($fee)
      {
          $this-&gt;fee = $fee;
      }
  
      public function getIsPay()
      {
          return $this-&gt;isPay;
      }
  
      public function setIsPay($is_pay)
      {
          $this-&gt;isPay = $is_pay;
      }
  
      public function setIsPrePay($is_prepay)
      {
          $this-&gt;isPrePay = $is_prepay;
      }
  
      public function getIsPrePay()
      {
          return $this-&gt;isPrePay;
      }
  
      public function getAttachment()
      {
          return $this-&gt;attachmentId;
      }
  
      public function setAttachment($attachment)
      {
          $this-&gt;attachmentId = $attachment;
  
          //return $this;
      }
  
      public function getStatus()
      {
          return $this-&gt;status;
      }
  
      public function setStatus($status)
      {
          $this-&gt;status = $status;
      }
  
      public function setUserId($user_id)
      {
          $this-&gt;user = $user_id;
      }
  
      public function getUserId($user_id)
      {
          return $this-&gt;user; 
      }
  }
  
  
  
  </code></pre>
  
  <p>My ProjectType (Form/ProjectType.php)</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace AppBundle\Form;
  
  use AppBundle\Entity\Project;
  use AppBundle\Entity\User;
  use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\Form\Extension\Core\Type\BaseType;
  use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
  use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  use Symfony\Component\Form\Extension\Core\Type\NumberType;
  use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
  use Symfony\Component\Form\Extension\Core\Type\TelType;
  use Symfony\Component\OptionsResolver\OptionsResolver;
  use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  
  class ProjectType extends AbstractType
  {
      /**
       * {@inheritdoc}
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('title')
          -&gt;add('type')
          -&gt;add('budget',IntegerType::class)
          -&gt;add('description',TextareaType::class)
          -&gt;add('registerDate',DateTimeType::class)
          -&gt;add('endDate',DateTimeType::class)
          -&gt;add('prePay',IntegerType::class)
          -&gt;add('fee',IntegerType::class,array('mapped'=&gt;false))
          -&gt;add('isPay',ChoiceType::class,[
              'choices'  =&gt; [
                  'Yes' =&gt; 1,
                  'No' =&gt; 0,
              ],
          ])
          -&gt;add('isPrePay',ChoiceType::class,[
              'choices'  =&gt; [
                  'Yes' =&gt; 1,
                  'No' =&gt; 0,
              ],
          ])
          -&gt;add('attachmentId',NumberType::class,array('mapped'=&gt;false))
          -&gt;add('status',ChoiceType::class,[
              'choices'  =&gt; [
                  'Pending Review' =&gt; 0,
                  'Pending PrePaid' =&gt; 1,
                  'In Process' =&gt; 2,
                  'End Work' =&gt; 3,
                  'Complete' =&gt; 4
              ],
          ])
          -&gt;add('user',NumberType::class,['mapped'=&gt;false]);
      }
  
      /**
       * {@inheritdoc}
       */
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; Project::class
          ));
      }
  
      /**
       * {@inheritdoc}
       */
      /*public function getBlockPrefix()
      {
          return 'appbundle_project';
      }*/
  
  
  
  
  }
  
  </code></pre>
  
  <p>My Project Controller file ( src/AppBundle/Controller/ProjectCntroller.php )</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  /*
   * This file is part of the Symfony package.
   *
   * (c) Fabien Potencier &lt;fabien@symfony.com&gt;
   *
   * For the full copyright and license information, please view the LICENSE
   * file that was distributed with this source code.
   */
  
  namespace AppBundle\Controller\Admin;
  
  use AppBundle\Entity\Project;
  use AppBundle\Form\ProjectType;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  
  /**
   * Project controller.
   *
   * @Route("/admin", name="admin_project_controller")
   * @Security("has_role('ROLE_ADMIN')")
   */
  class ProjectController extends Controller
  {
      /**
       * Lists all project entities.
       *
       * @Route("/project", name="admin_project_index")
       * @Method("GET")
       */
      public function indexAction()
      {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
  
          $projects = $em-&gt;getRepository(Project::class)-&gt;findAll();
  
          return $this-&gt;render('admin/project/index.html.twig', array(
              'projects' =&gt; $projects,
          ));
      }
  
      /**
       * Creates a new project entity.
       *
       * @Route("/project/new", name="admin_project_new")
       * @Method({"GET", "POST"})
       */
      public function newAction(Request $request)
      {
          $project = new Project();
          $form = $this-&gt;createForm(ProjectType::class, $project);
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;persist($project);
              $em-&gt;flush();
  
              return $this-&gt;redirectToRoute('admin_project_show', array('id' =&gt; $project-&gt;getId()));
          }
  
          return $this-&gt;render('admin/project/new.html.twig', array(
              'project' =&gt; $project,
              'form' =&gt; $form-&gt;createView(),
          ));
      }
  
      /**
       * Finds and displays a project entity.
       *
       * @Route("/project/{id}", name="admin_project_show")
       * @Method("GET")
       */
      public function showAction(Project $project)
      {
          $deleteForm = $this-&gt;createDeleteForm($project);
  
          return $this-&gt;render('admin/project/show.html.twig', array(
              'project' =&gt; $project,
              'delete_form' =&gt; $deleteForm-&gt;createView(),
          ));
      }
  
      /**
       * Displays a form to edit an existing project entity.
       *
       * @Route("/project/{id}/edit", name="admin_project_edit")
       * @Method({"GET", "POST"})
       */
      public function editAction(Request $request, Project $project)
      {
          $deleteForm = $this-&gt;createDeleteForm($project);
          $editForm = $this-&gt;createForm(ProjectType::class, $project);
          $editForm-&gt;handleRequest($request);
  
          if ($editForm-&gt;isSubmitted() &amp;&amp; $editForm-&gt;isValid()) {
              $this-&gt;getDoctrine()-&gt;getManager()-&gt;flush();
  
              return $this-&gt;redirectToRoute('admin_project_edit', array('id' =&gt; $project-&gt;getId()));
          }
  
          return $this-&gt;render('admin/project/edit.html.twig', array(
              'project' =&gt; $project,
              'edit_form' =&gt; $editForm-&gt;createView(),
              'delete_form' =&gt; $deleteForm-&gt;createView(),
          ));
      }
  
      /**
       * Deletes a project entity.
       *
       * @Route("/project/{id}", name="admin_project_delete")
       * @Method("DELETE")
       */
      public function deleteAction(Request $request, Project $project)
      {
          $form = $this-&gt;createDeleteForm($project);
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;remove($project);
              $em-&gt;flush();
          }
  
          return $this-&gt;redirectToRoute('admin_project_index');
      }
  
      /**
       * Creates a form to delete a project entity.
       *
       * @param Project $project The project entity
       *
       * @return \Symfony\Component\Form\Form The form
       */
      private function createDeleteForm(Project $project)
      {
          return $this-&gt;createFormBuilder()
              -&gt;setAction($this-&gt;generateUrl('admin_project_delete', array('id' =&gt; $project-&gt;getId())))
              -&gt;setMethod('DELETE')
              -&gt;getForm()
          ;
      }
  }
  
  </code></pre>
  
  <p>My index.twig file ( apop/Resource/views/admins/project/index.html.twig)</p>
  
  <pre class="lang-php prettyprint-override"><code>{% extends 'base.html.twig' %}
  
  {% block body %}
      &lt;h1&gt;Projects list&lt;/h1&gt;
  
      &lt;table&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Id&lt;/th&gt;
                  &lt;th&gt;Title&lt;/th&gt;
                  &lt;th&gt;Type&lt;/th&gt;
                  &lt;th&gt;Budget&lt;/th&gt;
                  &lt;th&gt;Description&lt;/th&gt;
                  &lt;th&gt;Registerdate&lt;/th&gt;
                  &lt;th&gt;Enddate&lt;/th&gt;
                  &lt;th&gt;Prepay&lt;/th&gt;
                  &lt;th&gt;Fee&lt;/th&gt;
                  &lt;th&gt;Ispay&lt;/th&gt;
                  &lt;th&gt;Isprepay&lt;/th&gt;
                  &lt;th&gt;Attachmentid&lt;/th&gt;
                  &lt;th&gt;Status&lt;/th&gt;
                  &lt;th&gt;Actions&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
          {% for project in projects %}
              &lt;tr&gt;
                  &lt;td&gt;&lt;a href="{{ path('admin_project_show', { 'id': project.id }) }}"&gt;{{ project.id }}&lt;/a&gt;&lt;/td&gt;
                  &lt;td&gt;{{ project.title }}&lt;/td&gt;
                  &lt;td&gt;{{ project.type }}&lt;/td&gt;
                  &lt;td&gt;{{ project.budget }}&lt;/td&gt;
                  &lt;td&gt;{{ project.description }}&lt;/td&gt;
                  &lt;td&gt;{% if project.registerDate %}{{ project.registerDate|date('Y-m-d H:i:s') }}{% endif %}&lt;/td&gt;
                  &lt;td&gt;{% if project.endDate %}{{ project.endDate|date('Y-m-d H:i:s') }}{% endif %}&lt;/td&gt;
                  &lt;td&gt;{{ project.prePay }}&lt;/td&gt;
                  &lt;td&gt;{{ project.fee }}&lt;/td&gt;
                  &lt;td&gt;{% if project.isPay %}Yes{% else %}No{% endif %}&lt;/td&gt;
                  &lt;td&gt;{% if project.isPrePay %}Yes{% else %}No{% endif %}&lt;/td&gt;
  
                  &lt;td&gt;{{ project.attachmentId }}&lt;/td&gt;
  
                  &lt;td&gt;{{ project.status }}&lt;/td&gt;
                  &lt;td&gt;
                      &lt;ul&gt;
                          &lt;li&gt;
                              &lt;a href="{{ path('admin_project_show', { 'id': project.id }) }}"&gt;show&lt;/a&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                              &lt;a href="{{ path('admin_project_edit', { 'id': project.id }) }}"&gt;edit&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          {% endfor %}
          &lt;/tbody&gt;
      &lt;/table&gt;
  
      &lt;ul&gt;
          &lt;li&gt;
              &lt;a href="{{ path('admin_project_new') }}"&gt;Create a new project&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  {% endblock %}
  
  </code></pre>
  
  <p>if i delete <code>{{ project.fee }}</code> from twig template i got same error but now for attachmentId and if delete <code>{{ project.attachmentId }}</code> theen these is no error.</p>
  
  <p>Thanks.</p>