FOSCommentBundle
FOSCommentBundle copied to clipboard
Compatible with easyadmin
Hi, in my project i use FOSCommentBundle and EasyAdmin on SF2.8
Your method "isCommentable" in Model\Thread.php is not modify with easyadmin....
config.yml for easyadmin: My Class Article is extend of BaseThread
Article:
class: AppBundle\Entity\Article
list:
fields:
- { property: 'id' }
- { property: 'isCommentable'}
EasyAdmin return this error:
Neither the property "isCommentable" nor one of the methods "addIsCommentable()"/"removeIsCommentable()", "setIsCommentable()", "isCommentable()", "__set()" or "__call()" exist and have public access in class "AppBundle\Entity\Article".
The problem: line 58 in Model\ThreadInterface.php (replace setCommentable with setisCommentable) line 105 in Model\Thread.php (replace setCommentable with setisCommentable)
Do you have solution to bypass this error or override these model ?
Thank you Best regards, Alexis.
same probleme for me and not only for isCommentable, i cannot access to other parameter like permalink or updateAt
I've never used FOSCommentBundle, but according to its docs (See https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/Resources/doc/2a-mapping_orm.md) you must create your own Thread or Comment class. So maybe you can solve your problem defining this method in your own Thread class:
// src/MyProject/MyBundle/Entity/Thread.php
namespace MyProject\MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\CommentBundle\Entity\Thread as BaseThread;
/**
* @ORM\Entity
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class Thread extends BaseThread
{
// ...
public function setIsCommentable($isCommentable)
{
$this->setCommentable($isCommentable);
}
}
tomorow i will try this.
it's better, the toggle is_commentable work but when i use update function it's don't work.
i have absolutely no post request when i click on save.
lol ok it's work but i need to erase this line *@ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") on tread entity EDIT : i also need to override this :
/**
* @return string
*/
public function getPermalink()
{
return "https://www.la-cave-a-nodo.fr/article/" . $this->slug;
}
$this->slug is just :
use Gedmo\Mapping\Annotation as Gedmo;
[...]
/**
* @Gedmo\Slug(fields={"titre"},separator="-", updatable=true, unique=true)
* @ORM\Column(length=128)
*/
private $slug;
I had exactly the same issue with EasyAdmin and FosComment. When removing @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") the comments are saved. I'm a bit concern as I don't really understand this TrackingPolicy if it's here it should be a reason. @NodokaMurmevent have you noticed side effect by removing this ?
yes a problem appared, test if when you update (NOT create a new) a post all modification work.