Made forum posting possible.
It has some limitations, though, as ForumTopic.last_post and ForumTopicGroup.last_post is not updated automagically...
This commit is contained in:
47
src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php
Normal file
47
src/KekRozsak/FrontBundle/Form/Type/ForumPostType.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace KekRozsak\FrontBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ForumPostType extends AbstractType
|
||||
{
|
||||
private $topicGroup;
|
||||
private $topic;
|
||||
|
||||
public function __construct($topicGroup = null, $topic = null)
|
||||
{
|
||||
$this->topicGroup = $topicGroup;
|
||||
$this->topic = $topic;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('created_at', 'hidden', array(
|
||||
'label' => 'Időpont',
|
||||
'data' => new \DateTime('now')
|
||||
));
|
||||
$builder->add('text', null, array(
|
||||
'label' => ' ',
|
||||
));
|
||||
$builder->add('topic', 'hidden', array(
|
||||
'property_path' => false,
|
||||
'data' => $this->topic,
|
||||
));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'forum_post';
|
||||
}
|
||||
|
||||
public function getDefaultOptions()
|
||||
{
|
||||
$opts = array(
|
||||
'data_class' => 'KekRozsak\FrontBundle\Entity\ForumPost',
|
||||
);
|
||||
|
||||
return $opts;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user