I have problem with doctrine 2. I have following db tables : So, Doctrine generate entities which retrive data from desk settings for site, but I need, to retrieve all settings from desk_settings table and overwrite its values from desk_settings_values table using desk_id
DB image -> https://docs.google.com/file/d/0B7rOFTJGfJwTWEQ3bXZFU1hXZlU/edit?usp=sharing
Doctrine entities which was generate with script:
/** * Desk * * @ORM\Table(name="desk") * @ORM\Entity */ class Desk { /** * @var integer * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string * * @ORM\Column(name="code", type="string", length=100, nullable=false) */ private $code; /** * @var string * * @ORM\Column(name="description", type="string", length=255, nullable=false) */ private $description; /** * @var \DateTime * * @ORM\Column(name="created", type="datetime", nullable=false) */ private $created; /** * @var \Doctrine\Common\Collections\Collection * * @ORM\ManyToMany(targetEntity="PayBox\Entity\DeskSettings", mappedBy="desk") */ private $deskSettings; }
use Doctrine\ORM\Mapping as ORM; /** * DeskSettings * * @ORM\Table(name="desk_settings") * @ORM\Entity */ class DeskSettings { /** * @var integer * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string * * @ORM\Column(name="setting_key", type="string", length=100, nullable=false) */ private $settingKey; /** * @var string * * @ORM\Column(name="setting_value", type="string", length=255, nullable=false) */ private $settingValue; /** * @var \DateTime * * @ORM\Column(name="created", type="datetime", nullable=false) */ private $created; /** * @var \Doctrine\Common\Collections\Collection * * @ORM\ManyToMany(targetEntity="PayBox\Entity\Desk", inversedBy="deskSettings") * @ORM\JoinTable(name="desk_settings_values", * joinColumns={ * @ORM\JoinColumn(name="desk_settings_id", referencedColumnName="id") * }, * inverseJoinColumns={ * @ORM\JoinColumn(name="desk_id", referencedColumnName="id") * } * ) */ private $desk; }