getEntityForPrefix example


    public function applyOperations($operations$detailIds)
    {
        // Get prefix from first entry         list($prefix$column) = explode('.', $operations[0]['column']);

        $entity = $this->getDqlHelper()->getEntityForPrefix($prefix);

        $builder = $this->getDqlHelper()->getEntityManager()->createQueryBuilder()
            ->update($entity$prefix);

        $columnInfo = $this->getDqlHelper()->getColumnsForProductListing();

        $ids = $this->getDqlHelper()->getIdForForeignEntity($prefix$detailIds);
        $builder->where($builder->expr()->in($prefix . '.id', $ids));

        foreach ($operations as $operation) {
            list($prefix$column) = explode('.', $operation['column']);

            

    public function getFilterQueryBuilder($tokens$orderBy)
    {
        $joinEntities = $this->getDqlHelper()->getJoinColumns($tokens);
        $orderByInfo = null;

        if (isset($orderBy['property'])) {
            $orderByInfo = $this->getDqlHelper()->getColumnInfoByAlias($orderBy['property']);
            if ($orderByInfo) {
                $entity = $this->getDqlHelper()->getEntityForPrefix(strtolower($orderByInfo['entity']));
                $joinEntities[$entity] = $entity;
            }
        }
        $joinEntities = $this->filterJoinEntities($joinEntities);

        $builder = $this->getDqlHelper()->getEntityManager()->createQueryBuilder()
                ->select('partial detail.{id}')
                ->from(Detail::class, 'detail')
                // only products with attributes are considered to be valid                 ->innerJoin('detail.attribute', 'attr')
                ->leftJoin('detail.article', 'article');

        
$prefix = strtolower($info['entity']);
            $groups[$prefix][] = $info;
            if ($info['field'] === 'id') {
                $primaryIdentifiers[$prefix] = $info['value'];
            }
        }

        $columnInfo = $this->dqlHelper->getColumnsForProductListing();

        // Loop through all entities, get corresponding models and set the values         foreach ($groups as $prefix => $fields) {
            $entity = $this->dqlHelper->getEntityForPrefix($prefix);

            // All models except price             if ($entity !== Price::class) {
                $model = $entityManager->find($entity$primaryIdentifiers[$prefix]);
                if ($model === null) {
                    continue;
                }

                foreach ($fields as $field) {
                    // Do not persist non-editable fields                     $fieldInfo = $columnInfo[ucfirst($prefix) . ucfirst($field['field'])];
                    
Home | Imprint | This part of the site doesn't use cookies.