title: Neither the property nor one of the methods exist and have public access in class
body: <p>I keep getting the following error after save data in the form:</p>
  
  <blockquote>
    <p>Neither the property "categories" nor one of the methods
    "addCategory()"/"removeCategory()", "setCategories()", "categories()",
    "__set()" or "__call()" exist and have public access in class
    "Apw\BlackbullBundle\Entity\Products".</p>
  </blockquote>
  
  <p>I've got 5 tables: Products, ProductsDescption, Categories, CategoriesDescription and ProductstoCategories.  But I keep getting the error above.</p>
  
  <p>I've got the following form builders:</p>
  
  <p><strong>ProductsType:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Apw\BlackbullBundle\Form;
  
  use Apw\BlackbullBundle\Entity\ProductsDescription;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  
  class ProductsType extends AbstractType
  {
      /**
       * @param FormBuilderInterface $builder
       * @param array $options
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('productsDescription', 'collection',
                  array(
                      'type' =&gt; new ProductsDescriptionType(),
                      'options' =&gt; array('data_class' =&gt; 'Apw\BlackbullBundle\Entity\ProductsDescription'),
                      'label' =&gt; 'Nome prodotto:'
                  ))
              -&gt;add('productsQuantity')
              -&gt;add('productsModel')
              -&gt;add('productsImage')
              -&gt;add('productsPrice')
              -&gt;add('productsDateAvailable', 'date', array(
                                                          'input'  =&gt; 'datetime',
                                                          'widget' =&gt; 'single_text',))
              -&gt;add('productsWeight')
              -&gt;add('productsStatus')
              -&gt;add('categories', 'entity', array(
                                              'class'       =&gt; 'ApwBlackbullBundle:CategoriesDescription',
                                              'property'    =&gt; 'categoriesName',
                                              'empty_value' =&gt; 'Scegliere una categoria',
                                              'required'    =&gt; false,
                                              'label'       =&gt; 'Crea in:'))
              -&gt;add('productsDescription', 'collection', array(
                                                          'type' =&gt; new ProductsDescriptionType(),
                                                          'options' =&gt; array('data_class' =&gt; 'Apw\BlackbullBundle\Entity\ProductsDescription'),
                                                          'label' =&gt; 'Descrizione prodotto:'))
              -&gt;add('salva','submit')
              -&gt;add('azzera','reset')
          ;
      }
  
      /**
       * @param OptionsResolverInterface $resolver
       */
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'Apw\BlackbullBundle\Entity\Products'
          ));
      }
  
      /**
       * @return string
       */
      public function getName()
      {
          return 'apw_blackbullbundle_products';
      }
  }
  </code></pre>
  
  <p><strong>My CategoryType:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Apw\BlackbullBundle\Form;
  
  use Doctrine\ORM\EntityRepository;
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  
  class CategoriesType extends AbstractType
  {
      /**
       * @param FormBuilderInterface $builder
       * @param array $options
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('categoryDescription', 'collection',
                  array(
                      'type' =&gt; new CategoriesDescriptionType(),
                      'allow_add' =&gt; true,
                      'options' =&gt; array('data_class' =&gt; 'Apw\BlackbullBundle\Entity\CategoriesDescription'),
                      'by_reference' =&gt; false,
                  ))
              //-&gt;add('categoriesImage', null, array('label'=&gt;'Foto:'))
              -&gt;add('categoriesStatus', null, array('label'=&gt;'Stato:'))
              -&gt;add('parentId', 'entity', array(
                                              'class'       =&gt; 'ApwBlackbullBundle:CategoriesDescription',
                                              'property'    =&gt; 'categoriesName',
                                              'empty_value' =&gt; 'Scegliere una categoria',
                                              'required'    =&gt; false,
                                              'label'       =&gt; 'Crea in:'))
              -&gt;add('salva','submit')
              -&gt;add('azzera','reset')
          ;
      }
  
      /**
       * @param OptionsResolverInterface $resolver
       */
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'Apw\BlackbullBundle\Entity\Categories',
          ));
      }
  
      /**
       * @return string
       */
      public function getName()
      {
          return 'categories';
      }
  }
  </code></pre>
  
  <p><strong>Class Products</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Apw\BlackbullBundle\Entity;
  
  use Doctrine\Common\Collections\ArrayCollection;
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Products
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass="Apw\BlackbullBundle\Entity\ProductsRepository")
   * @ORM\HasLifecycleCallbacks()
   */
  
  class Products
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="products_quantity", type="integer", nullable = true)
       */
      private $productsQuantity;
  
      /**
       * @var string
       *
       * @ORM\Column(name="products_model", type="string", length=12, nullable = true)
       */
      private $productsModel;
  
      /**
       * @var string
       *
       * @ORM\Column(name="products_image", type="string", length=64, nullable = true)
       */
      private $productsImage;
  
      /**
       * @var string
       *
       * @ORM\Column(name="products_price", type="decimal", nullable = true)
       */
      private $productsPrice;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="products_date_added", type="datetime", nullable = true)
       */
      private $productsDateAdded;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="products_last_modified", type="datetime", nullable = true)
       */
      private $productsLastModified;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="products_date_available", type="datetime", nullable = true)
       */
      private $productsDateAvailable;
  
      /**
       * @var string
       *
       * @ORM\Column(name="products_weight", type="decimal", nullable = true)
       */
      private $productsWeight;
  
      /**
       * @var boolean
       *
       * @ORM\Column(name="products_status", type="boolean", nullable = true)
       */
      private $productsStatus;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="products_ordered", type="integer", nullable = true)
       */
      private $productsOrdered;
  
      /**
       * @ORM\OneToMany(targetEntity="ProductsDescription", mappedBy="product")
       */
      private $productsDescription;
  
      /**
       * @ORM\ManyToMany(targetEntity="Categories", inversedBy="products")
       * @ORM\JoinTable(name="productstocategories")
       */
      private $categories;
  
      /**
       * @ORM\OneToOne(targetEntity="Manufacturers", inversedBy="products")
       * @ORM\JoinColumn(name="manufacturers_id", referencedColumnName="id")
       **/
      private $manufacturers;
  
      /**
       * @ORM\OneToMany(targetEntity="ProductsImages", mappedBy="products")
       */
      private $productsImages;
  
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set productsQuantity
       *
       * @param integer $productsQuantity
       * @return Products
       */
      public function setProductsQuantity($productsQuantity)
      {
          $this-&gt;productsQuantity = $productsQuantity;
  
          return $this;
      }
  
      /**
       * Get productsQuantity
       *
       * @return integer 
       */
      public function getProductsQuantity()
      {
          return $this-&gt;productsQuantity;
      }
  
      /**
       * Set productsModel
       *
       * @param string $productsModel
       * @return Products
       */
      public function setProductsModel($productsModel)
      {
          $this-&gt;productsModel = $productsModel;
  
          return $this;
      }
  
      /**
       * Get productsModel
       *
       * @return string 
       */
      public function getProductsModel()
      {
          return $this-&gt;productsModel;
      }
  
      /**
       * Set productsImage
       *
       * @param string $productsImage
       * @return Products
       */
      public function setProductsImage($productsImage)
      {
          $this-&gt;productsImage = $productsImage;
  
          return $this;
      }
  
      /**
       * Get productsImage
       *
       * @return string 
       */
      public function getProductsImage()
      {
          return $this-&gt;productsImage;
      }
  
      /**
       * Set productsPrice
       *
       * @param string $productsPrice
       * @return Products
       */
      public function setProductsPrice($productsPrice)
      {
          $this-&gt;productsPrice = $productsPrice;
  
          return $this;
      }
  
      /**
       * Get productsPrice
       *
       * @return string 
       */
      public function getProductsPrice()
      {
          return $this-&gt;productsPrice;
      }
  
      /**
       * Set productsDateAdded
       *
       * @param \DateTime $productsDateAdded
       * @return Products
       */
      public function setProductsDateAdded($productsDateAdded)
      {
          $this-&gt;productsDateAdded = $productsDateAdded;
  
          return $this;
      }
  
      /**
       * Get productsDateAdded
       *
       * @return \DateTime 
       */
      public function getProductsDateAdded()
      {
          return $this-&gt;productsDateAdded;
      }
  
      /**
       * Set productsLastModified
       *
       * @param \DateTime $productsLastModified
       * @return Products
       */
      public function setProductsLastModified($productsLastModified)
      {
          $this-&gt;productsLastModified = $productsLastModified;
  
          return $this;
      }
  
      /**
       * Get productsLastModified
       *
       * @return \DateTime 
       */
      public function getProductsLastModified()
      {
          return $this-&gt;productsLastModified;
      }
  
      /**
       * Set productsDateAvailable
       *
       * @param \DateTime $productsDateAvailable
       * @return Products
       */
      public function setProductsDateAvailable($productsDateAvailable)
      {
          $this-&gt;productsDateAvailable = $productsDateAvailable;
  
          return $this;
      }
  
      /**
       * Get productsDateAvailable
       *
       * @return \DateTime 
       */
      public function getProductsDateAvailable()
      {
          return $this-&gt;productsDateAvailable;
      }
  
      /**
       * Set productsWeight
       *
       * @param string $productsWeight
       * @return Products
       */
      public function setProductsWeight($productsWeight)
      {
          $this-&gt;productsWeight = $productsWeight;
  
          return $this;
      }
  
      /**
       * Get productsWeight
       *
       * @return string 
       */
      public function getProductsWeight()
      {
          return $this-&gt;productsWeight;
      }
  
      /**
       * Set productsStatus
       *
       * @param boolean $productsStatus
       * @return Products
       */
      public function setProductsStatus($productsStatus)
      {
          $this-&gt;productsStatus = $productsStatus;
  
          return $this;
      }
  
      /**
       * Get productsStatus
       *
       * @return boolean 
       */
      public function getProductsStatus()
      {
          return $this-&gt;productsStatus;
      }
  
      /**
       * Set productsOrdered
       *
       * @param integer $productsOrdered
       * @return Products
       */
      public function setProductsOrdered($productsOrdered)
      {
          $this-&gt;productsOrdered = $productsOrdered;
  
          return $this;
      }
  
      /**
       * Get productsOrdered
       *
       * @return integer 
       */
      public function getProductsOrdered()
      {
          return $this-&gt;productsOrdered;
      }
  
  
      /**
       * Set manufacturers
       *
       * @param \Apw\BlackbullBundle\Entity\Manufacturers $manufacturers
       * @return Products
       */
      public function setManufacturers(\Apw\BlackbullBundle\Entity\Manufacturers $manufacturers = null)
      {
          $this-&gt;manufacturers = $manufacturers;
  
          return $this;
      }
  
      /**
       * Get manufacturers
       *
       * @return \Apw\BlackbullBundle\Entity\Manufacturers 
       */
      public function getManufacturers()
      {
          return $this-&gt;manufacturers;
      }
  
      /**
       * @ORM\PrePersist
       */
      public function setCreatedAtValue()
      {
          $date = new \DateTime();
          $this-&gt;productsDateAdded = new \DateTime($date-&gt;format('d-m-Y H:i:s'));
      }
  
      /**
       * Add productsImages
       *
       * @param \Apw\BlackbullBundle\Entity\ProductsImages $productsImages
       * @return Products
       */
      public function addProductsImage(\Apw\BlackbullBundle\Entity\ProductsImages $productsImages)
      {
          $this-&gt;productsImages[] = $productsImages;
  
          return $this;
      }
  
      /**
       * Remove productsImages
       *
       * @param \Apw\BlackbullBundle\Entity\ProductsImages $productsImages
       */
      public function removeProductsImage(\Apw\BlackbullBundle\Entity\ProductsImages $productsImages)
      {
          $this-&gt;productsImages-&gt;removeElement($productsImages);
      }
  
      /**
       * Get productsImages
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getProductsImages()
      {
          return $this-&gt;productsImages;
      }
  
      /**
       * Constructor
       */
      public function __construct()
      {
          $this-&gt;categories = new ArrayCollection();
          $this-&gt;productsImages = new ArrayCollection();
          $this-&gt;productsDescription = new ArrayCollection();
      }
  
      /**
       * Add categories
       *
       * @param \Apw\BlackbullBundle\Entity\Categories $categories
       * @return Products
       */
      public function addCategory(\Apw\BlackbullBundle\Entity\Categories $categories)
      {
          $this-&gt;categories[] = $categories;
  
          return $this;
      }
  
      /**
       * Remove categories
       *
       * @param \Apw\BlackbullBundle\Entity\Categories $categories
       */
      public function removeCategory(\Apw\BlackbullBundle\Entity\Categories $categories)
      {
          $this-&gt;categories-&gt;removeElement($categories);
      }
  
      /**
       * Get categories
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getCategories()
      {
          return $this-&gt;categories;
      }
  
      /**
       * Add productsDescription
       *
       * @param \Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription
       * @return Products
       */
      public function addProductsDescription(\Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription)
      {
          $this-&gt;productsDescription[] = $productsDescription;
  
          return $this;
      }
  
      /**
       * Remove productsDescription
       *
       * @param \Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription
       */
      public function removeProductsDescription(\Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription)
      {
          $this-&gt;productsDescription-&gt;removeElement($productsDescription);
      }
  
      /**
       * Get productsDescription
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getProductsDescription()
      {
          return $this-&gt;productsDescription;
      }
  }
  </code></pre>
  
  <p><strong>Class Categories</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Apw\BlackbullBundle\Entity;
  
  use Doctrine\Common\Collections\ArrayCollection;
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Categories
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass="Apw\BlackbullBundle\Entity\CategoriesRepository")
   */
  class Categories
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="categories_image", type="string", length=64, nullable = true)
       */
      private $categoriesImage;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="parent_id", type="integer", nullable = true, options={"default":0})
       */
      private $parentId;
  
      /**
       * @var integer
       *
       * @ORM\Column(name="sort_order", type="integer", nullable = true, options={"default":0})
       */
      private $sortOrder;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="date_added", type="datetime", nullable = true)
       */
      private $dateAdded;
  
      /**
       * @var \DateTime
       *
       * @ORM\Column(name="last_modified", type="datetime", nullable = true)
       */
      private $lastModified;
  
      /**
       * @var boolean
       *
       * @ORM\Column(name="categories_status", type="boolean", nullable = true, options={"default" = 1})
       */
      private $categoriesStatus;
  
      /**
       * @ORM\OneToMany(targetEntity="CategoriesDescription", mappedBy="category")
       */
      private $categoryDescription;
  
      /**
       * @ORM\ManyToMany(targetEntity="Products", mappedBy="categories")
       **/
      private $products;
  
      /**
       * Get id
       *
       * @return integer
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set categoriesImage
       *
       * @param string $categoriesImage
       * @return Categories
       */
      public function setCategoriesImage($categoriesImage)
      {
          $this-&gt;categoriesImage = $categoriesImage;
  
          return $this;
      }
  
      /**
       * Get categoriesImage
       *
       * @return string
       */
      public function getCategoriesImage()
      {
          return $this-&gt;categoriesImage;
      }
  
      /**
       * Set parentId
       *
       * @param integer $parentId
       * @return Categories
       */
      public function setParentId($parentId)
      {
          $this-&gt;parentId = $parentId;
  
          return $this;
      }
  
      /**
       * Get parentId
       *
       * @return integer
       */
      public function getParentId()
      {
          return $this-&gt;parentId;
      }
  
      /**
       * Set sortOrder
       *
       * @param string $sortOrder
       * @return Categories
       */
      public function setSortOrder($sortOrder)
      {
          $this-&gt;sortOrder = $sortOrder;
  
          return $this;
      }
  
      /**
       * Get sortOrder
       *
       * @return string
       */
      public function getSortOrder()
      {
          return $this-&gt;sortOrder;
      }
  
      /**
       * Set dateAdded
       *
       * @param \DateTime $dateAdded
       * @return Categories
       */
      public function setDateAdded($dateAdded)
      {
          $this-&gt;dateAdded = $dateAdded;
  
          return $this;
      }
  
      /**
       * Get dateAdded
       *
       * @return \DateTime
       */
      public function getDateAdded()
      {
          return $this-&gt;dateAdded;
      }
  
      /**
       * Set lastModified
       *
       * @param \DateTime $lastModified
       * @return Categories
       */
      public function setLastModified($lastModified)
      {
          $this-&gt;lastModified = $lastModified;
  
          return $this;
      }
  
      /**
       * Get lastModified
       *
       * @return \DateTime
       */
      public function getLastModified()
      {
          return $this-&gt;lastModified;
      }
  
      /**
       * Constructor
       */
      public function __construct()
      {
          $this-&gt;categoryDescription = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;products = new \Doctrine\Common\Collections\ArrayCollection();
      }
  
      /**
       * Add categoryDescription
       *
       * @param \Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription
       * @return Categories
       */
      public function addCategoryDescription(\Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription)
      {
          $this-&gt;categoryDescription[] = $categoryDescription;
  
          return $this;
      }
  
      /**
       * Remove categoryDescription
       *
       * @param \Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription
       */
      public function removeCategoryDescription(\Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription)
      {
          $this-&gt;categoryDescription-&gt;removeElement($categoryDescription);
      }
  
      /**
       * Get categoryDescription
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getCategoryDescription()
      {
          return $this-&gt;categoryDescription;
      }
  
      /**
       * Add products
       *
       * @param \Apw\BlackbullBundle\Entity\Products $products
       * @return Categories
       */
      public function addProduct(\Apw\BlackbullBundle\Entity\Products $products)
      {
          $products-&gt;addCategory($this);
           $this-&gt;products[] = $products;
  
          return $this;
      }
  
      /**
       * Remove products
       *
       * @param \Apw\BlackbullBundle\Entity\Products $products
       */
      public function removeProduct(\Apw\BlackbullBundle\Entity\Products $products)
      {
          $this-&gt;products-&gt;removeElement($products);
      }
  
      /**
       * Get products
       *
       * @return \Doctrine\Common\Collections\Collection
       */
      public function getProducts()
      {
          return $this-&gt;products;
      }
  
      /**
       * Set categoriesStatus
       *
       * @param boolean $categoriesStatus
       * @return Categories
       */
      public function setCategoriesStatus($categoriesStatus)
      {
          $this-&gt;categoriesStatus = $categoriesStatus;
  
          return $this;
      }
  
      /**
       * Get categoriesStatus
       *
       * @return boolean
       */
      public function getCategoriesStatus()
      {
          return $this-&gt;categoriesStatus;
      }
  }
  </code></pre>
  
  <p><strong>This is my CategoriesDescription class:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Apw\BlackbullBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * CategoriesDescription
   *
   * @ORM\Table()
   * @ORM\Entity(repositoryClass="Apw\BlackbullBundle\Entity\CategoriesDescriptionRepository")
   */
  class CategoriesDescription
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string
       *
       * @ORM\Column(name="categories_name", type="string", length=32, nullable=true)
       */
      private $categoriesName;
  
      /**
      * @ORM\ManyToOne(targetEntity="Categories", inversedBy="categoryDescription")
      **/
      private $category;
  
      /**
       * @ORM\ManyToOne(targetEntity="Languages", inversedBy="categoriesDescription")
       * @ORM\JoinColumn(name="languages_id", referencedColumnName="id")
       **/
      private $languages;
  
      public function __toString() {
          return $this-&gt;categoriesName;
      }
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set categoriesName
       *
       * @param string $categoriesName
       * @return CategoriesDescription
       */
      public function setCategoriesName($categoriesName)
      {
          $this-&gt;categoriesName = $categoriesName;
  
          return $this;
      }
  
      /**
       * Get categoriesName
       *
       * @return string 
       */
      public function getCategoriesName()
      {
          return $this-&gt;categoriesName;
      }
  
      /**
       * Set languages
       *
       * @param \Apw\BlackbullBundle\Entity\Languages $languages
       * @return CategoriesDescription
       */
      public function setLanguages(\Apw\BlackbullBundle\Entity\Languages $languages = null)
      {
          $this-&gt;languages = $languages;
  
          return $this;
      }
  
      /**
       * Get languages
       *
       * @return \Apw\BlackbullBundle\Entity\Languages 
       */
      public function getLanguages()
      {
          return $this-&gt;languages;
      }
  
      /**
       * Set category
       *
       * @param \Apw\BlackbullBundle\Entity\Categories $category
       * @return CategoriesDescription
       */
      public function setCategory(\Apw\BlackbullBundle\Entity\Categories $category = null)
      {
          $this-&gt;category = $category;
  
          return $this;
      }
  
      /**
       * Get category
       *
       * @return \Apw\BlackbullBundle\Entity\Categories
       */
      public function getCategory()
      {
          return $this-&gt;category;
      }
  }
  </code></pre>
  
  <p>any idea? where wrong? </p>