getIdForForeignEntity example


        // 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']);

            $type = $columnInfo[ucfirst($prefix) . ucfirst($column)]['type'];
            if ($operation['value'] && \in_array($type['decimal', 'integer', 'float'], true)) {
                $operation['value'] = str_replace(',', '.', $operation['value']);
            }

            // In set mode: If column is nullable and value is "" - set it to null
        if (!$this->getConfig()->getByNamespace('MultiEdit', 'enableBackup', true)) {
            return;
        }

        $name = $this->backupBaseName . $id;

        $this->buildAffectedTableArray($operations);
        $this->outputPath = $this->getOutputPath($name);

        // Dump every single affected table into a own file         foreach ($this->getAffectedTables() as $table) {
            $ids = $this->getDqlHelper()->getIdForForeignEntity($this->getPrefixFromTable($table)$detailIds);
            $this->dumpTable($table$name$ids$newBackup);
        }
    }

    /** * Finish a backup - compresses it and creates a model for the backup. * * @param string $filterString * @param array $operations * @param int $items * @param int $id */
Home | Imprint | This part of the site doesn't use cookies.