I have a Entity of TeamMembers. And the TeamMember can have a Specification with a value.
So I have three Entities: TeamMember, Specifications, SpecificationValues.
In the SpecificationValue table I want to store the TeamMember_id, the Specification_id and the value that is just for that TeamMember.
The Specifications and TeamMembers Entities are working. But now I want to show all the Specifications, if I go to the edit route (see code example) of a TeamMember, and have to possibility over there to fill in some values that I want to store in the SpecificationValue Entity.
[TeamMember > Specifications]: list of all specifications, with a extra input field where I can insert some values, that will be stored in the SpecificationValues entity.
<?php
namespace My\BundleName\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* SpecificationValue
*
* @ORM\Table()
* @ORM\Entity
*/
class SpecificationValue
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Specifications")
* @ORM\JoinColumn(name="specification_id", referencedColumnName="id")
*/
protected $specification;
/**
* @ORM\ManyToOne(targetEntity="TeamMembers")
* @ORM\JoinColumn(name="teammember_id", referencedColumnName="id")
*/
protected $teammember;
/**
* @var string
* @ORM\Column(name="value", type="string", length=222)
*/
protected $value;
}
/**
* Specifications
*
* @ORM\Table()
* @ORM\Entity
*/
class Specifications
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
* @Gedmo\Translatable
*/
protected $name;
/**
* @ORM\ManyToOne(targetEntity="SpecificationCategory")
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
*/
protected $category;
}
/**
* TeamMembers
*
* @ORM\Table()
* @ORM\Entity
*/
class TeamMembers
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=250)
*/
protected $name;
/**
* @var boolean
*
* @ORM\Column(name="active", type="boolean")
*/
protected $active = true;
}
And the Forms are generated with generate:crud. this is how the form should look like > http://i.stack.imgur.com/Nkkdy.png
But is that even possible with Entities in Symfony?