getExpressionBuilder example

/** * Helper function to create the query builder for the "getAdminRuleDeleteQuery" function. * This function can be hooked to modify the query builder of the query object. * * @param int $roleId * * @return QueryBuilder */
    public function getAdminRuleDeleteQueryBuilder($roleId)
    {
        $builder = $this->getEntityManager()->createQueryBuilder();
        $expr = $this->getEntityManager()->getExpressionBuilder();
        $builder->delete(Rule::class, 'rule')
                ->where('rule.roleId = ?1')
                ->setParameter(1, $roleId)
                ->andWhere($expr->isNull('rule.resourceId'))
                ->andWhere($expr->isNull('rule.privilegeId'));

        return $builder;
    }
}
$association['sourceEntity'],
            $association['inversedBy']
        );

        if (!empty($filter)) {
            $builder->addFilter($filter);
        }
        if (!empty($sort)) {
            $builder->addOrderBy($sort);
        }

        $expr = $this->getManager()->getExpressionBuilder();
        $builder->andWhere(
            $expr->orX(
                $expr->eq($association['fieldName'] . '.id', ':id')
            )
        );
        $builder->setParameter('id', $id);

        $builder->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = $this->getQueryPaginator($builder);

        

    public function getStatisticListQueryBuilder($order$partnerId$summary$fromDate$toDate$userCurrencyFactor = 1)
    {
        /** @var QueryBuilder $builder */
        $builder = $this->getEntityManager()->createQueryBuilder();
        $expr = $this->getEntityManager()->getExpressionBuilder();

        $builder->select([
                'o.orderTime as orderTime',
                'o.id as id',
                'o.number as number',
                'SUM((o.invoiceAmountNet - o.invoiceShippingNet) / (o.currencyFactor / :userCurrencyFactor)) as netTurnOver',
                'SUM((o.invoiceAmountNet - o.invoiceShippingNet) / (o.currencyFactor / :userCurrencyFactor) / 100 * partner.percent) as provision',
                'customer.email as customerEmail',
                'billing.company as customerCompany',
                'customer.firstname as customerFirstName',
                'customer.lastname as customerLastName',
                
Home | Imprint | This part of the site doesn't use cookies.