@param TemplateEntityInterface $templateEntity
@param bool                    $recip

@return $this
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
12994
public function removeTemplateEntity(
        TemplateEntityInterface $templateEntity,
        bool $recip = true
    ): self {
        $this->removeFromEntityCollectionAndNotify('templateEntities', $templateEntity);
        if ($this instanceof ReciprocatesTemplateEntityInterface && true === $recip) {
            $this->removeRelationOnTemplateEntity(
                $templateEntity
            );
        }

        return $this;
    }
888620
public function setReturnReceiptType(\Innova\CollecticielBundle\Entity\ReturnReceiptType $returnReceiptType = null)
    {
        $this->returnReceiptType = $returnReceiptType;

        return $this;
    }
531675
protected function initializeApiLog(SpyPaymentPayone $paymentEntity, AbstractRequestContainer $container)
    {
        $entity = new SpyPaymentPayoneApiLog();
        $entity->setSpyPaymentPayone($paymentEntity);
        $entity->setRequest($container->getRequest());
        $entity->setMode($container->getMode());
        $entity->setMerchantId($container->getMid());
        $entity->setPortalId($container->getPortalid());
        if ($container instanceof CaptureContainer || $container instanceof RefundContainer || $container instanceof DebitContainer) {
            $entity->setSequenceNumber($container->getSequenceNumber());
        }
        // Logging request data for debug
        $entity->setRawRequest(json_encode($container->toArray()));
        $entity->save();

        return $entity;
    }
493161
protected function createHttpRequest(RequestEntity $requestEntity) {
		$requestEntity->validate();
		$httpClient = new Client();
		$httpClient->baseUrl = $this->getBaseUrl();
		$request = $httpClient->createRequest();
		$request
			->setOptions($requestEntity->options)
			->setMethod($requestEntity->method)
			->setUrl($requestEntity->uri)
			->setData($requestEntity->data)
			->setHeaders($requestEntity->headers)
			->addHeaders(['user-agent' => 'Awesome-Octocat-App']);
		return $request;
	}
971457
public function setBodyEntity($bodyEntity, $requestFormat = null)
    {
        $this->bodyEntity = $bodyEntity;
        if ($requestFormat !== null) {
            $this->setRequestFormat($requestFormat);
        }

        return $this;
    }
749976
protected function addPropertyChild($propertyValue, ContextInterface $context, $last)
    {
        // If the property value is a thing and this is the element's last property
        if (($propertyValue instanceof ThingInterface) && $last) {
            // Set the thing as parent thing for nested iterations
            $context = $context->setParentThing($propertyValue);
        }

        return $context;
    }
1190361
public function offsetSet($mOffset, $oEntity)
    {
        $this->checkClass($oEntity);

        return parent::offsetSet($mOffset, $oEntity);
    }
1145472
public function buildWithSubQuery(VictoireQueryInterface $containerEntity, QueryBuilder $itemsQueryBuilder, EntityManager $em)
    {
        //get the query of the container entity
        $query = $containerEntity->getQuery();
        if (method_exists($containerEntity, 'additionnalQueryPart')) {
            $query = $containerEntity->additionnalQueryPart();
        }

        if ($query !== '' && $query !== null) {
            $subQuery = $em->createQueryBuilder()
                                ->select('item.id')
                                ->from($itemsQueryBuilder->getRootEntities()[0], 'item');

            $itemsQueryBuilder->andWhere(
                sprintf('main_item.id IN (%s %s)', $subQuery->getQuery()->getDql(), $query)
            );
        }

        //Add ORDER BY if set
        if ($orderBy = json_decode($containerEntity->getOrderBy(), true)) {
            foreach ($orderBy as $addOrderBy) {
                $reflectionClass = new \ReflectionClass($itemsQueryBuilder->getRootEntities()[0]);
                $reflectionProperty = $reflectionClass->getProperty($addOrderBy['by']);

                //If ordering field is an association, treat it as a boolean
                if ($this->isAssociationField($reflectionProperty)) {
                    $itemsQueryBuilder->addSelect('CASE WHEN main_item.'.$addOrderBy['by'].' IS NULL THEN 0 ELSE 1 END AS HIDDEN caseOrder');
                    $itemsQueryBuilder->addOrderBy('caseOrder', $addOrderBy['order']);
                } else {
                    $itemsQueryBuilder->addOrderBy('main_item.'.$addOrderBy['by'], $addOrderBy['order']);
                }
            }
        }

        $currentView = $this->currentView;

        // If the current page is a BEP, we parse all its properties and inject them as query parameters
        if ($currentView() && $currentView() instanceof BusinessPage && null !== $currentEntity = $currentView()->getBusinessEntity()) {

            // NEW
            $metadatas = $em->getClassMetadata(get_class($currentEntity));
            foreach ($metadatas->fieldMappings as $fieldName => $field) {
                if (strpos($query, ':'.$fieldName) !== false) {
                    $itemsQueryBuilder->setParameter($fieldName, $metadatas->getFieldValue($currentEntity, $fieldName));
                }
            }
            foreach ($metadatas->associationMappings as $fieldName => $field) {
                if (strpos($query, ':'.$fieldName) !== false) {
                    $itemsQueryBuilder->setParameter($fieldName, $metadatas->getFieldValue($currentEntity, $fieldName)->getId());
                }
            }

            if (strpos($query, ':currentEntity') !== false) {
                $itemsQueryBuilder->setParameter('currentEntity', $currentEntity->getId());
            }
        } elseif ($currentView() instanceof BusinessTemplate && strpos($query, ':currentEntity') !== false) {
            $itemsQueryBuilder->setParameter('currentEntity', $containerEntity->getEntity()->getId());
        }

        if (strpos($query, ':currentUser') !== false && is_object($this->getCurrentUser())) {
            $itemsQueryBuilder->setParameter('currentUser', $this->getCurrentUser()->getId());
        }

        return $itemsQueryBuilder;
    }
429988
public function add($input, $name = null, $recursive = false)
    {
        if (is_array($input)
            || ($input instanceof Traversable && !$input instanceof InputFilterInterface)
        ) {
            $factory = $this->getFactory();
            $input = $factory->createInput($input);
        }

        if (!$input instanceof InputInterface && !$input instanceof ZendInputFilterInterface) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s expects an instance of %s or %s as its first argument; received "%s"',
                __METHOD__,
                InputInterface::class,
                ZendInputFilterInterface::class,
                (is_object($input) ? get_class($input) : gettype($input))
            ));
        }

        if ($input instanceof InputInterface && (empty($name) || is_int($name))) {
            $name = $input->getName();
        }

        if (isset($this->inputs[$name]) &&
            ($this->inputs[$name] instanceof InputInterface
                || ($recursive && $this->inputs[$name] instanceof ZendInputFilterInterface))
        ) {
            // The element already exists, so merge the config. Please note
            // that this merges the new input into the original.
            $original = $this->inputs[$name];
            if ($original !== $input) {
                $original->merge($input, $recursive);
            }
        } else {
            $this->inputs[$name] = $input;
        }

        if ($input instanceof InputInterface || $input instanceof InputFilterInterface) {
            $filter = $input->getFilterChain();
            $this->bindClosureFilter($filter);
        }

        return $this;
    }
1085343
protected function mapToPropertyTagname($property, $value, $xmlEntry, $entity, $stackEntity)
    {
        if ($this->mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity) === false) {
            $this->mapXMLElementToEntity($xmlEntry, $entity, $stackEntity);
        }
    }
279984
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AuthorizationContainerInterface
    {
        $authorizationContainer = new AuthorizationContainer();
        $authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer);
        $authorizationContainer = $this->mapEmail($paymentEntity, $authorizationContainer);
        $authorizationContainer = $this->mapBusinessRelation($authorizationContainer);
        $authorizationContainer->setAmount($orderTransfer->getTotals()->getGrandTotal());

        return $authorizationContainer;
    }
197207
private function getFluidStandaloneViewWithTemplate($templatePath = '')
    {
        $standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
        $standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePath));

        return $standaloneView;
    }
327610
public function sendTemplateAsync($templateId, $sendEmail)
    {
        return $this->sendTemplateAsyncWithHttpInfo($templateId, $sendEmail)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
666979
public function display($tpl, $outputtype = '', $trusted = true)
    {
        $previousTpl = $this->_templateName;
        $this->_templateName = $tpl;
        $this->recursiveTpl[] = $tpl;
        $md = $this->getTemplate($tpl, $outputtype, $trusted);

        $fct = 'template_'.$md;
        $fct($this);
        array_pop($this->recursiveTpl);
        $this->_templateName = $previousTpl;
    }
1050495
protected function mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity)
    {
        $classSchema = $this->reflectionService->getClassSchema(get_class($entity));

        if ($classSchema->hasProperty($property)) {
            $propertyDefinition = $classSchema->getProperty($property);

            switch (true) {
                    case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class, true):

                        foreach ($xmlEntry->children() as $xmlChildEntry) {
                            $name = $xmlChildEntry->getName();
                            $childEntity = new $propertyDefinition['elementType']();
                            $entityForTagName = $this->getEntityForTagName($childEntity, $xmlEntry, $name, $stackEntity);

                            if (is_a($entityForTagName, $propertyDefinition['elementType'], true)) {
                                $entity->_getProperty($property)->attach($childEntity);
                            }

                            $this->mapXMLElementToEntity($xmlChildEntry, $entityForTagName, $stackEntity);
                        }

                        break;
                    case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\DomainObject\AbstractEntity::class, true):

                        $subEntity = $entity->_getProperty($property);
                        if (!$subEntity) {
                            $subEntity = new $propertyDefinition['type']();
                            $entity->_setProperty($property, $subEntity);
                        }

                        $this->mapXMLElementToEntity($xmlEntry, $subEntity, $stackEntity);
                        break;
                    case is_a($propertyDefinition['type'], \DateTime::class, true):

                        if (!empty($value)) {
                            $dateTime = new \DateTime($value);
                            $entity->_setProperty($property, $dateTime);
                        }

                        break;

                    default:
                        $entity->_setProperty($property, $value);
            }

            return true;
        } else {
            return false;
        }
    }
349771
public function getNotifiableInterface(NotifiableEntity $notifiableEntity)
    {
        return $this->notifiableRepository->findNotifiableInterface(
            $notifiableEntity,
            $this->getNotifiableEntityIdentifiers($notifiableEntity)
        );
    }
860224
public static function metaForTemplateEntity(
        ClassMetadataBuilder $builder
    ): void {
        $unidirectionalManyToOne = $builder->createManyToOne(
            TemplateEntity::getDoctrineStaticMeta()->getSingular(),
            TemplateEntity::class
        );
        $unidirectionalManyToOne->addJoinColumn(
            Inflector::tableize(
                TemplateEntity::getDoctrineStaticMeta()->getSingular()
            ) . '_' . IdFieldInterface::PROP_ID,
            IdFieldInterface::PROP_ID,
            true
        )->build();
    }