I keep getting the following error after save data in the form:

> 
> 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".
> 
> 
> 

I've got 5 tables: Products, ProductsDescption, Categories, CategoriesDescription and ProductstoCategories. But I keep getting the error above.

I've got the following form builders:

**ProductsType:**

```
<?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
            ->add('productsDescription', 'collection',
                array(
                    'type' => new ProductsDescriptionType(),
                    'options' => array('data_class' => 'Apw\BlackbullBundle\Entity\ProductsDescription'),
                    'label' => 'Nome prodotto:'
                ))
            ->add('productsQuantity')
            ->add('productsModel')
            ->add('productsImage')
            ->add('productsPrice')
            ->add('productsDateAvailable', 'date', array(
                                                        'input'  => 'datetime',
                                                        'widget' => 'single_text',))
            ->add('productsWeight')
            ->add('productsStatus')
            ->add('categories', 'entity', array(
                                            'class'       => 'ApwBlackbullBundle:CategoriesDescription',
                                            'property'    => 'categoriesName',
                                            'empty_value' => 'Scegliere una categoria',
                                            'required'    => false,
                                            'label'       => 'Crea in:'))
            ->add('productsDescription', 'collection', array(
                                                        'type' => new ProductsDescriptionType(),
                                                        'options' => array('data_class' => 'Apw\BlackbullBundle\Entity\ProductsDescription'),
                                                        'label' => 'Descrizione prodotto:'))
            ->add('salva','submit')
            ->add('azzera','reset')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Apw\BlackbullBundle\Entity\Products'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'apw_blackbullbundle_products';
    }
}

```

**My CategoryType:**

```
<?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
            ->add('categoryDescription', 'collection',
                array(
                    'type' => new CategoriesDescriptionType(),
                    'allow_add' => true,
                    'options' => array('data_class' => 'Apw\BlackbullBundle\Entity\CategoriesDescription'),
                    'by_reference' => false,
                ))
            //->add('categoriesImage', null, array('label'=>'Foto:'))
            ->add('categoriesStatus', null, array('label'=>'Stato:'))
            ->add('parentId', 'entity', array(
                                            'class'       => 'ApwBlackbullBundle:CategoriesDescription',
                                            'property'    => 'categoriesName',
                                            'empty_value' => 'Scegliere una categoria',
                                            'required'    => false,
                                            'label'       => 'Crea in:'))
            ->add('salva','submit')
            ->add('azzera','reset')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Apw\BlackbullBundle\Entity\Categories',
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'categories';
    }
}

```

**Class Products**

```
<?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->id;
    }

    /**
     * Set productsQuantity
     *
     * @param integer $productsQuantity
     * @return Products
     */
    public function setProductsQuantity($productsQuantity)
    {
        $this->productsQuantity = $productsQuantity;

        return $this;
    }

    /**
     * Get productsQuantity
     *
     * @return integer 
     */
    public function getProductsQuantity()
    {
        return $this->productsQuantity;
    }

    /**
     * Set productsModel
     *
     * @param string $productsModel
     * @return Products
     */
    public function setProductsModel($productsModel)
    {
        $this->productsModel = $productsModel;

        return $this;
    }

    /**
     * Get productsModel
     *
     * @return string 
     */
    public function getProductsModel()
    {
        return $this->productsModel;
    }

    /**
     * Set productsImage
     *
     * @param string $productsImage
     * @return Products
     */
    public function setProductsImage($productsImage)
    {
        $this->productsImage = $productsImage;

        return $this;
    }

    /**
     * Get productsImage
     *
     * @return string 
     */
    public function getProductsImage()
    {
        return $this->productsImage;
    }

    /**
     * Set productsPrice
     *
     * @param string $productsPrice
     * @return Products
     */
    public function setProductsPrice($productsPrice)
    {
        $this->productsPrice = $productsPrice;

        return $this;
    }

    /**
     * Get productsPrice
     *
     * @return string 
     */
    public function getProductsPrice()
    {
        return $this->productsPrice;
    }

    /**
     * Set productsDateAdded
     *
     * @param \DateTime $productsDateAdded
     * @return Products
     */
    public function setProductsDateAdded($productsDateAdded)
    {
        $this->productsDateAdded = $productsDateAdded;

        return $this;
    }

    /**
     * Get productsDateAdded
     *
     * @return \DateTime 
     */
    public function getProductsDateAdded()
    {
        return $this->productsDateAdded;
    }

    /**
     * Set productsLastModified
     *
     * @param \DateTime $productsLastModified
     * @return Products
     */
    public function setProductsLastModified($productsLastModified)
    {
        $this->productsLastModified = $productsLastModified;

        return $this;
    }

    /**
     * Get productsLastModified
     *
     * @return \DateTime 
     */
    public function getProductsLastModified()
    {
        return $this->productsLastModified;
    }

    /**
     * Set productsDateAvailable
     *
     * @param \DateTime $productsDateAvailable
     * @return Products
     */
    public function setProductsDateAvailable($productsDateAvailable)
    {
        $this->productsDateAvailable = $productsDateAvailable;

        return $this;
    }

    /**
     * Get productsDateAvailable
     *
     * @return \DateTime 
     */
    public function getProductsDateAvailable()
    {
        return $this->productsDateAvailable;
    }

    /**
     * Set productsWeight
     *
     * @param string $productsWeight
     * @return Products
     */
    public function setProductsWeight($productsWeight)
    {
        $this->productsWeight = $productsWeight;

        return $this;
    }

    /**
     * Get productsWeight
     *
     * @return string 
     */
    public function getProductsWeight()
    {
        return $this->productsWeight;
    }

    /**
     * Set productsStatus
     *
     * @param boolean $productsStatus
     * @return Products
     */
    public function setProductsStatus($productsStatus)
    {
        $this->productsStatus = $productsStatus;

        return $this;
    }

    /**
     * Get productsStatus
     *
     * @return boolean 
     */
    public function getProductsStatus()
    {
        return $this->productsStatus;
    }

    /**
     * Set productsOrdered
     *
     * @param integer $productsOrdered
     * @return Products
     */
    public function setProductsOrdered($productsOrdered)
    {
        $this->productsOrdered = $productsOrdered;

        return $this;
    }

    /**
     * Get productsOrdered
     *
     * @return integer 
     */
    public function getProductsOrdered()
    {
        return $this->productsOrdered;
    }

    /**
     * Set manufacturers
     *
     * @param \Apw\BlackbullBundle\Entity\Manufacturers $manufacturers
     * @return Products
     */
    public function setManufacturers(\Apw\BlackbullBundle\Entity\Manufacturers $manufacturers = null)
    {
        $this->manufacturers = $manufacturers;

        return $this;
    }

    /**
     * Get manufacturers
     *
     * @return \Apw\BlackbullBundle\Entity\Manufacturers 
     */
    public function getManufacturers()
    {
        return $this->manufacturers;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        $date = new \DateTime();
        $this->productsDateAdded = new \DateTime($date->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->productsImages[] = $productsImages;

        return $this;
    }

    /**
     * Remove productsImages
     *
     * @param \Apw\BlackbullBundle\Entity\ProductsImages $productsImages
     */
    public function removeProductsImage(\Apw\BlackbullBundle\Entity\ProductsImages $productsImages)
    {
        $this->productsImages->removeElement($productsImages);
    }

    /**
     * Get productsImages
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getProductsImages()
    {
        return $this->productsImages;
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->categories = new ArrayCollection();
        $this->productsImages = new ArrayCollection();
        $this->productsDescription = new ArrayCollection();
    }

    /**
     * Add categories
     *
     * @param \Apw\BlackbullBundle\Entity\Categories $categories
     * @return Products
     */
    public function addCategory(\Apw\BlackbullBundle\Entity\Categories $categories)
    {
        $this->categories[] = $categories;

        return $this;
    }

    /**
     * Remove categories
     *
     * @param \Apw\BlackbullBundle\Entity\Categories $categories
     */
    public function removeCategory(\Apw\BlackbullBundle\Entity\Categories $categories)
    {
        $this->categories->removeElement($categories);
    }

    /**
     * Get categories
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getCategories()
    {
        return $this->categories;
    }

    /**
     * Add productsDescription
     *
     * @param \Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription
     * @return Products
     */
    public function addProductsDescription(\Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription)
    {
        $this->productsDescription[] = $productsDescription;

        return $this;
    }

    /**
     * Remove productsDescription
     *
     * @param \Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription
     */
    public function removeProductsDescription(\Apw\BlackbullBundle\Entity\ProductsDescription $productsDescription)
    {
        $this->productsDescription->removeElement($productsDescription);
    }

    /**
     * Get productsDescription
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getProductsDescription()
    {
        return $this->productsDescription;
    }
}

```

**Class Categories**

```
<?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->id;
    }

    /**
     * Set categoriesImage
     *
     * @param string $categoriesImage
     * @return Categories
     */
    public function setCategoriesImage($categoriesImage)
    {
        $this->categoriesImage = $categoriesImage;

        return $this;
    }

    /**
     * Get categoriesImage
     *
     * @return string
     */
    public function getCategoriesImage()
    {
        return $this->categoriesImage;
    }

    /**
     * Set parentId
     *
     * @param integer $parentId
     * @return Categories
     */
    public function setParentId($parentId)
    {
        $this->parentId = $parentId;

        return $this;
    }

    /**
     * Get parentId
     *
     * @return integer
     */
    public function getParentId()
    {
        return $this->parentId;
    }

    /**
     * Set sortOrder
     *
     * @param string $sortOrder
     * @return Categories
     */
    public function setSortOrder($sortOrder)
    {
        $this->sortOrder = $sortOrder;

        return $this;
    }

    /**
     * Get sortOrder
     *
     * @return string
     */
    public function getSortOrder()
    {
        return $this->sortOrder;
    }

    /**
     * Set dateAdded
     *
     * @param \DateTime $dateAdded
     * @return Categories
     */
    public function setDateAdded($dateAdded)
    {
        $this->dateAdded = $dateAdded;

        return $this;
    }

    /**
     * Get dateAdded
     *
     * @return \DateTime
     */
    public function getDateAdded()
    {
        return $this->dateAdded;
    }

    /**
     * Set lastModified
     *
     * @param \DateTime $lastModified
     * @return Categories
     */
    public function setLastModified($lastModified)
    {
        $this->lastModified = $lastModified;

        return $this;
    }

    /**
     * Get lastModified
     *
     * @return \DateTime
     */
    public function getLastModified()
    {
        return $this->lastModified;
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->categoryDescription = new \Doctrine\Common\Collections\ArrayCollection();
        $this->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->categoryDescription[] = $categoryDescription;

        return $this;
    }

    /**
     * Remove categoryDescription
     *
     * @param \Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription
     */
    public function removeCategoryDescription(\Apw\BlackbullBundle\Entity\CategoriesDescription $categoryDescription)
    {
        $this->categoryDescription->removeElement($categoryDescription);
    }

    /**
     * Get categoryDescription
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCategoryDescription()
    {
        return $this->categoryDescription;
    }

    /**
     * Add products
     *
     * @param \Apw\BlackbullBundle\Entity\Products $products
     * @return Categories
     */
    public function addProduct(\Apw\BlackbullBundle\Entity\Products $products)
    {
        $products->addCategory($this);
         $this->products[] = $products;

        return $this;
    }

    /**
     * Remove products
     *
     * @param \Apw\BlackbullBundle\Entity\Products $products
     */
    public function removeProduct(\Apw\BlackbullBundle\Entity\Products $products)
    {
        $this->products->removeElement($products);
    }

    /**
     * Get products
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getProducts()
    {
        return $this->products;
    }

    /**
     * Set categoriesStatus
     *
     * @param boolean $categoriesStatus
     * @return Categories
     */
    public function setCategoriesStatus($categoriesStatus)
    {
        $this->categoriesStatus = $categoriesStatus;

        return $this;
    }

    /**
     * Get categoriesStatus
     *
     * @return boolean
     */
    public function getCategoriesStatus()
    {
        return $this->categoriesStatus;
    }
}

```

**This is my CategoriesDescription class:**

```
<?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->categoriesName;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set categoriesName
     *
     * @param string $categoriesName
     * @return CategoriesDescription
     */
    public function setCategoriesName($categoriesName)
    {
        $this->categoriesName = $categoriesName;

        return $this;
    }

    /**
     * Get categoriesName
     *
     * @return string 
     */
    public function getCategoriesName()
    {
        return $this->categoriesName;
    }

    /**
     * Set languages
     *
     * @param \Apw\BlackbullBundle\Entity\Languages $languages
     * @return CategoriesDescription
     */
    public function setLanguages(\Apw\BlackbullBundle\Entity\Languages $languages = null)
    {
        $this->languages = $languages;

        return $this;
    }

    /**
     * Get languages
     *
     * @return \Apw\BlackbullBundle\Entity\Languages 
     */
    public function getLanguages()
    {
        return $this->languages;
    }

    /**
     * Set category
     *
     * @param \Apw\BlackbullBundle\Entity\Categories $category
     * @return CategoriesDescription
     */
    public function setCategory(\Apw\BlackbullBundle\Entity\Categories $category = null)
    {
        $this->category = $category;

        return $this;
    }

    /**
     * Get category
     *
     * @return \Apw\BlackbullBundle\Entity\Categories
     */
    public function getCategory()
    {
        return $this->category;
    }
}

```

any idea? where wrong?