/** * Checks if the entity can have comments * * @param object|null $entity * * @return bool */ public function isApplicable($entity) { if (!is_object($entity) || !$this->doctrineHelper->isManageableEntity($entity) || !$this->securityFacade->isGranted('oro_comment_view')) { return false; } return $this->commentAssociationHelper->isCommentAssociationEnabled(ClassUtils::getClass($entity)); }
public function testIsCommentAssociationEnabledForEnabledButNotAccessibleAssociationButWithAccessibleFalse() { $entityClass = 'Test\\Entity'; $config = new Config(new EntityConfigId('comment', $entityClass)); $config->set('enabled', true); $this->configManager->expects($this->once())->method('hasConfig')->with($entityClass)->willReturn(true); $this->configManager->expects($this->once())->method('getEntityConfig')->with('comment', $entityClass)->willReturn($config); $this->configManager->expects($this->never())->method('getFieldConfig'); $this->assertTrue($this->commentAssociationHelper->isCommentAssociationEnabled($entityClass, false)); }
/** * {@inheritdoc} */ public function isCommentsEnabled($entityClass) { return $this->commentAssociationHelper->isCommentAssociationEnabled($entityClass); }