Q:

Dropdown not showing category of an article

I'm building a website with symfony. I'm trying to get a page to show a form with nested objects. An Artikel can have just one category. There are many artikels and many categories.
/**
 * Artikel
 *
 * @ORM\Table(name="artikel", indexes=
    {@ORM\Index(name="IDX_A4375C338C9B60D8", columns={"idartikeltype"})})
 * @ORM\Entity
 */
class Artikel
{
....
/**
 * @ORM\Column(type="integer")
 *
 */
private $idartikeltype;

/**
 * @var ArtikelCategory
 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\ArtikelCategory"
   ,inversedBy="type")
 * @ORM\JoinColumn(name="idartikeltype", 
   referencedColumnName="idartikeltype")
 */
private $category;

/**
 * @var integer
 *
 * @ORM\Column(name="idArtikel", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="IDENTITY")
 */
private $idartikel;

......

My class ArtikelCategory 
class ArtikelCategory
{
/**
 * @var string
 * /**
 * @ORM\OneToMany(targetEntity="AppBundle\Entity\Artikel", 
mappedBy="category",cascade={ALL})
 *
 * @ORM\Column(name="type", type="string", length=45, nullable=false)
 */
private $type;

/**
 * @var integer
 *
 * @ORM\Column(name="idartikeltype", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="IDENTITY")
 */
private $idartikeltype;

/**
 * @return string
 */
public function getType()
{
    return $this->type;
}

/**
 * @param string $type
 */
public function setType($type)
{
    $this->type = $type;
}

/**
 * @return int
 */
public function getIdartikeltype()
{
    return $this->idartikeltype;
}

/**
 * @param int $idartikeltype
 */
public function setIdartikeltype($idartikeltype)
{
    $this->idartikeltype = $idartikeltype;
}

public function __toString() {

    return $this->getType()
        ;

}

public function __construct(){
    $this->type = new ArrayCollection();
}
}

ArtikelType
public function buildForm
( FormBuilderInterface $builder , array 
    $options 
        )
        {
           $builder
        ->add ('titel', TextType::class,array('label'=>'Titel'))

        ->add('datum',DateType::class,array('label'=>'Date'))

        ->add('category' , 

  EntityType::class,array
('class'=>\AppBundle\Entity\ArtikelCategory::class,'label'=>'Page',
            'query_builder'=>function(EntityRepository $er){ return $er-
>createQueryBuilder('t')->orderBy('t.type','ASC');}

        ))

        ->add('tekst',CKEditorType::class,array('label'=>'Text'))

        ->add('save',SubmitType::class,array('label'=>'Save item'))
        ;

}

public function configureOptions(OptionsResolver $resolver)
{
    $resolver->setDefaults(array('data_class'=>'AppBundle\Entity\Artikel',));
} 

InputController
$item = $this-> getDoctrine()->getRepository(Artikel::class)->find($id);

    $form = $this->createForm(ArtikelType::class, $item);

    $form->handleRequest($request);

    if($form->isSubmitted() && $form -> isValid())
    {

        $em= $this->getDoctrine()->getManager();

        $em->persist($item);
        $em->flush();
       return $this->redirectToRoute('input');

    }

    return $this->render('input/input.html.twig', array('form'=>$form->createView(),));

Normally the dropdown should show the category of the artikel as in the database but ...

... In my form, the dropdownlist is not showing the category of an artikel and when i persist the artikel, the new category is not saved.
Icant figure this one out! Help.

A:

Mea Culpa,  when i read Association Mapping  , It got me thinking. Now i know i'm using a Many-to-One Unidirectional association.
The rest was a piece of cake....
Thx.

