Ability to assign documents to groups.

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2012-09-13 12:08:29 +02:00
parent a8f1f85573
commit 0f112feabe
3 changed files with 17 additions and 12 deletions

View File

@ -210,7 +210,12 @@ class Document
/** /**
* @var Doctrine\Common\Collections\ArrayCollection $groups * @var Doctrine\Common\Collections\ArrayCollection $groups
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents") * @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", inversedBy="documents")
* @ORM\JoinTable(name="group_document", joinColumns={
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
* }, inverseJoinColumns={
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/ */
protected $groups; protected $groups;
@ -234,7 +239,7 @@ class Document
*/ */
public function getGroups() public function getGroups()
{ {
return $this->group; return $this->groups;
} }
/** /**

View File

@ -354,12 +354,7 @@ class Group
* *
* @var Doctrine\Common\Collections\ArrayCollection $documents * @var Doctrine\Common\Collections\ArrayCollection $documents
* *
* @ORM\ManyToMany(targetEntity="Document", inversedBy="groups", fetch="LAZY") * @ORM\ManyToMany(targetEntity="Document", mappedBy="groups", fetch="LAZY")
* @ORM\JoinTable(name="group_document", inverseJoinColumns={
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
* }, joinColumns={
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/ */
protected $documents; protected $documents;

View File

@ -12,14 +12,19 @@ class DocumentType extends AbstractType
$builder->add('title', null, array( $builder->add('title', null, array(
'label' => 'A dokumentum címe', 'label' => 'A dokumentum címe',
) )
); )
$builder->add('content', 'ckeditor', array( ->add('groups', null, array(
'label' => 'Csoportok',
'property' => 'name',
'required' => true,
)
)
->add('content', 'ckeditor', array(
'label' => ' ', 'label' => ' ',
) )
); );
// TODO: possibility to add to other groups!
} }
public function getName() public function getName()