/**
  * {@inheritdoc}
  */
 protected function getPermissionForAttribute($class, $identifier, $attribute)
 {
     /** @var MarketingListStateItemInterface $item */
     $item = $this->doctrineHelper->getEntityRepository($this->className)->find($identifier);
     $entityClass = $item->getMarketingList()->getEntity();
     $entity = $this->doctrineHelper->getEntityRepository($entityClass)->find($item->getEntityId());
     if (!$entity) {
         return self::ACCESS_ABSTAIN;
     }
     $contactInformationFields = $this->contactInformationFieldsProvider->getEntityTypedFields($entityClass, ContactInformationFieldsProvider::CONTACT_INFORMATION_SCOPE_EMAIL);
     $contactInformationValues = $this->contactInformationFieldsProvider->getTypedFieldsValues($contactInformationFields, $entity);
     $qb = $this->getQueryBuilder($contactInformationValues, $item);
     $result = $qb->getQuery()->getScalarResult();
     if (!empty($result)) {
         return self::ACCESS_DENIED;
     }
     return self::ACCESS_ABSTAIN;
 }
 /**
  * @param string $entityClassName
  * @param array  $data
  * @return array
  */
 protected function getContactInformationFieldsValues($entityClassName, array $data)
 {
     $contactInformationFields = $this->contactInformationFieldsProvider->getEntityTypedFields($entityClassName, ContactInformationFieldsProvider::CONTACT_INFORMATION_SCOPE_EMAIL);
     $values = $this->contactInformationFieldsProvider->getTypedFieldsValues($contactInformationFields, $data);
     return array_filter($values);
 }
 /**
  * @param array $contactInfoFields
  * @param string $type
  * @param array $expected
  *
  * @dataProvider fieldsDataProvider
  */
 public function testGetEntityTypedFields($contactInfoFields, $type, $expected)
 {
     $entity = '\\stdClass';
     $this->assertGetEntityTypedFieldsCalls($entity, $contactInfoFields);
     $this->assertEquals($expected, $this->provider->getEntityTypedFields($entity, $type));
 }