@param AttributeInterface $attribute
@param bool               $enforceFamilyCondition

@return AttributeQueryBuilderInterface
353862
public function attribute(AttributeInterface $attribute, $enforceFamilyCondition = true)
    {
        $attributeQb = new AttributeQueryBuilder($this, $attribute, $enforceFamilyCondition);
        if ($this->context) {
            $attributeQb->setContext($this->context);
        }

        return $attributeQb;
    }
189341
protected function getQueryBuilderByAttribute(Request $request, AttributeInterface $attribute)
    {
        $term = '%'.trim($request->get('term'), '%').'%';

        if (!$attribute->getType()->isRelation() && !$attribute->getType()->isEmbedded()) {
            $family = $attribute->getFamily();
            $repository = $this->entityManager->getRepository($family->getDataClass());
            if (!$repository instanceof DataRepository) {
                throw new \UnexpectedValueException(
                    "Repository for class {$family->getDataClass()} must be a DataRepository"
                );
            }
            $eavQb = $repository->createFamilyQueryBuilder($family);
            $attributeQb = $eavQb->attribute($attribute);
            $qb = $eavQb->apply($attributeQb->like($term));
            $qb
                ->select($attributeQb->getColumn())
                ->groupBy($attributeQb->getColumn())
                ->orderBy($attributeQb->getColumn());

            return $qb;
        }

        /** @var array $familyCodes */
        $familyCodes = $attribute->getOption('allowed_families', []);
        $families = [];
        foreach ($familyCodes as $familyCode) {
            $families[] = $this->familyRegistry->getFamily($familyCode);
        }

        return $this->dataManager->getQbForFamiliesAndLabel($families, $term);
    }
752033
public function getValueData(AttributeInterface $attribute, array $context = null)
    {
        $valuesData = $this->getValuesData($attribute, $context);

        return 0 === \count($valuesData) ? null : $valuesData->first();
    }
1088214
public function getFilterField(AttributeInterface $attribute)
    {
        $field = $attribute->getAttributeCode();

        if ($attribute->usesSource()) {
            $field = $this->getOptionTextFieldName($field);
        }

        return $field;
    }
183596
public function addAttributeValue(AttributeValueInterface $attributeValue)
    {
        if (!$this->attributeValues->contains($attributeValue)) {
            $attributeValue->setSubject($this);
            $this->attributeValues->add($attributeValue);
        }

        return $this;
    }
388840
protected function getAttributeMethods(FamilyInterface $family, AttributeInterface $attribute)
    {
        if ($this->isAttributeInherited($family, $attribute)) {
            return '';
        }
        $content = '';
        $dataClass = new \ReflectionClass($family->getDataClass());

        $getter = 'get'.ucfirst($attribute->getCode());
        if (!$dataClass->hasMethod($getter)) {
            $content .= $this->generateGetAnnotation($family, $attribute);
            $content .= "abstract public function {$getter}(array \$context = null);\n\n";
        }

        $setter = 'set'.ucfirst($attribute->getCode());
        if (!$dataClass->hasMethod($setter)) {
            $content .= $this->generateSetAnnotation($family, $attribute);
            $content .= 'abstract public function set'.ucfirst($attribute->getCode());
            $content .= '($value, array $context = null);'."\n\n";
        }

        if ($attribute->isCollection()) {
            // Adder and remover
            $setter = 'add'.ucfirst($attribute->getCode());
            if (!$dataClass->hasMethod($setter)) {
                $content .= $this->generateSetAnnotation($family, $attribute, true);
                $content .= 'abstract public function add'.ucfirst($attribute->getCode());
                $content .= '($value, array $context = null);'."\n\n";
            }

            $setter = 'remove'.ucfirst($attribute->getCode());
            if (!$dataClass->hasMethod($setter)) {
                $content .= $this->generateSetAnnotation($family, $attribute, true);
                $content .= 'abstract public function remove'.ucfirst($attribute->getCode());
                $content .= '($value, array $context = null);'."\n\n";
            }
        }

        return $content;
    }
908573
protected function denormalizeAttribute(
        FamilyInterface $family,
        $attributeCode,
        $value,
        $format,
        array $context
    ) {
        // @T0D0 handles standard serializer annotations ?
        $classMetadata = $this->entityManager->getClassMetadata($family->getDataClass());
        if ($classMetadata->hasAssociation($attributeCode)) {
            $targetClass = $classMetadata->getAssociationTargetClass($attributeCode);

            return $this->denormalizeRelation($value, $targetClass, $format, $context);
        }

        if ($classMetadata->hasField($attributeCode)) {
            $type = $classMetadata->getTypeOfField($attributeCode);
            if ('datetime' === $type || 'date' === $type) {
                return $this->denormalizeRelation($value, \DateTime::class, $format, $context);
            }
        }

        return $value;
    }
274295
public static function init($model, $propertyName, $annotation, $forceInit = false)
    {
        $className = BeanFactory::getObjectClass($model);

        if(!$forceInit)
        {
            $autoSelect = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoSelect::class)[0] ?? null;
            if($autoSelect && !$autoSelect->status)
            {
                return;
            }
        }

        if(is_array($annotation))
        {
            $firstAnnotation = reset($annotation);
            if($firstAnnotation instanceof \Imi\Model\Annotation\Relation\PolymorphicToOne)
            {
                static::initByPolymorphicToOne($model, $propertyName, $annotation);
            }
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\OneToOne)
        {
            static::initByOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\OneToMany)
        {
            static::initByOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\ManyToMany)
        {
            static::initByManyToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToOne)
        {
            static::initByPolymorphicOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToMany)
        {
            static::initByPolymorphicOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicManyToMany)
        {
            static::initByPolymorphicManyToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicToMany)
        {
            static::initByPolymorphicToMany($model, $propertyName, $annotation);
        }
    }
204502
protected function resolveBuilder(
        FormBuilderInterface $builder,
        AttributeInterface $attribute,
        array $options = []
    ) {
        $group = $attribute->getGroup();
        if (null === $group || $options['ignore_group']) {
            return $builder;
        }

        $groupPath = explode('.', $group);

        $subBuilder = $builder;
        foreach ($groupPath as $level => $groupCode) {
            $subBuilder = $this->buildFieldset($subBuilder, $attribute, $groupPath, $level, $options);
        }

        return $subBuilder;
    }
1152096
public function attributeValidationException(AbstractAttribute $attribute, ValidationException $e)
    {
        $attrException = new AttributeValidationException($e->getMessage());
        $attrException->addError($attribute->getName(), $e->getMessage());

        return $attrException;
    }
451906
public function getAttributeAutocompleteField(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute)
    {
        return $this->attributeHelper->getFilterField($attribute);
    }
431593
protected function parseParentChildConditions(
        ModelRelationshipDefinitionInterface $definition
    ) {
        if (null !== ($childConditions = $this->getFromDca('dca_config/childCondition'))) {
            foreach ((array) $childConditions as $childCondition) {
                /** @var ParentChildConditionInterface $relationship */
                $relationship = $definition->getChildCondition($childCondition['from'], $childCondition['to']);
                if (!$relationship instanceof ParentChildConditionInterface) {
                    $relationship = new ParentChildCondition();
                    $relationship
                        ->setSourceName($childCondition['from'])
                        ->setDestinationName($childCondition['to']);
                    $definition->addChildCondition($relationship);
                    $setter  = $childCondition['setOn'];
                    $inverse = $childCondition['inverse'];
                } else {
                    $setter  = \array_merge_recursive((array) $childCondition['setOn'], $relationship->getSetters());
                    $inverse = \array_merge_recursive(
                        (array) $childCondition['inverse'],
                        $relationship->getInverseFilterArray()
                    );
                }

                $relationship
                    ->setFilterArray(
                        FilterBuilder::fromArray($relationship->getFilterArray())
                            ->getFilter()
                            ->append(
                                FilterBuilder::fromArray((array) $childCondition['filter'])
                            )
                            ->getAllAsArray()
                    )
                    ->setSetters($setter)
                    ->setInverseFilterArray($inverse);
            }
        }
    }
125400
protected function createDefaultValues(AttributeInterface $attribute, array $context = null)
    {
        $default = $attribute->getDefault();
        if (!$attribute->isCollection()) {
            $default = (array) $default;
        }

        return $this->setInternalValuesData($attribute, $default, $context);
    }
1354713
protected function resolveAttributeConfig(AttributeInterface $attribute, array $options)
    {
        $attributeConfig = [];
        if (array_key_exists('fieldset_options', $options)) {
            $attributeConfig['fieldset_options'] = $options['fieldset_options']; // Copy all fieldset options
        }
        if (isset($options['attributes_config'][$attribute->getCode()])) {
            return array_merge($attributeConfig, $options['attributes_config'][$attribute->getCode()]);
        }

        return array_merge($attributeConfig, $attribute->getOption('attribute_config', []));
    }
367446
protected function getFilterField(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute)
    {
        return $this->mappingHelper->getFilterField($attribute);
    }
727268
public function createComparatorConstraint(Attributes $attributes): ComparatorConstraint {
		return new PropertyValueComparatorConstraint($this->criteriaProperty,
				$attributes->reqEnum(self::ATTR_OPERATOR_KEY, $this->getOperators()),
				CrIt::c($attributes->get(self::ATTR_VALUE_KEY)));
	}
322102
protected function applyAttributeQueryBuilder(
        AttributeQueryBuilderInterface $attributeQb,
        $data
    ): AttributeQueryBuilderInterface {
        $input = $data['input'];
        switch ($data['option']) {
            case 'exact':
                return $attributeQb->equals($input);
            case 'like_':
                return $attributeQb->like(trim($input, '%').'%');
            case '_like':
                return $attributeQb->like('%'.trim($input, '%'));
            case '_like_':
                return $attributeQb->like('%'.trim($input, '%').'%');
            case 'notlike_':
                return $attributeQb->notLike(trim($input, '%').'%');
            case '_notlike':
                return $attributeQb->notLike('%'.trim($input, '%'));
            case '_notlike_':
                return $attributeQb->notLike('%'.trim($input, '%').'%');
            case 'empty':
                return $attributeQb->equals('');
            case 'notempty':
                return $attributeQb->notEquals('');
            case 'null':
                return $attributeQb->isNull();
            case 'notnull':
                return $attributeQb->isNotNull();
        }
        throw new \UnexpectedValueException("Unknown option '{$data['option']}'");
    }