Clean collection select to remove duplicated fields.

@return \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\FilterableAttribute\Category\Collection
484663
private function removeAdditionalTableDuplicateFields()
    {
        $columns = $this->getSelect()->getPart(\Zend_Db_Select::COLUMNS);

        foreach ($columns as $idx => $column) {
            if ($column[0] == 'additional_table' && $column[1] == "*") {
                unset($columns[$idx]);
            }
        }

        $this->getSelect()->setPart(\Zend_Db_Select::COLUMNS, $columns);

        foreach ($this->getAdditionalTableFields() as $fieldName) {
            $this->getSelect()->columns([$fieldName => sprintf("additional_table.%s", $fieldName)]);
        }

        return $this;
    }
522528
public function preDelete()
    {
        $attId = $this->id();
        $joinProto = $this->modelFactory()->get(Join::class);
        $loader = $this->collectionLoader();
        $loader->setModel($joinProto);

        $collection = $loader->addFilter('attachment_id', $attId)->load();

        foreach ($collection as $obj) {
            $obj->delete();
        }

        return parent::preDelete();
    }
1138657
public function clean()
    {
        $this->removedTags = array();
        $elem = $this->getRealElement();
        if (is_null($elem)) {
            return array();
        }
        $this->cleanNodes($elem, true);
        return $this->removedTags;
    }
87072
public function findAndRemove()
    {
        $mongoDocument = $this->collection->getMongoCollection()->findAndModify(
            $this->expression->toArray(),
            null,
            $this->projection,
            array(
                'remove' => true,
                'sort' => $this->sort,
            )
        );

        if (empty($mongoDocument)) {
            return null;
        }

        return $this->collection->hydrate(
            $mongoDocument,
            $this->isDocumentPoolUsed()
        );
    }
230609
public function trashAction()
    {
        /** @var AbstractAdmin $admin */
        $admin = $this->getAdmin();

        $admin->checkAccess('undelete');

        /** @var EntityManager $em */
        $em = $this->get('doctrine')->getManager();

        $filters = $em->getFilters();

        if ($filters->isEnabled('softdeleteable')) {
            $filters->disable('softdeleteable');
        }

        if (!$filters->isEnabled('softdeleteabletrash')) {
            $filters->enable('softdeleteabletrash');
        }

        /** @var SoftDeleteableTrashFilter $softdeleteabletrash */
        $softdeleteabletrash = $filters->getFilter('softdeleteabletrash');

        $softdeleteabletrash->enableForEntity($admin->getClass());

        $datagrid = $admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->get('twig')->getExtension(FormExtension::class)->renderer->setTheme($formView, $admin->getFilterTheme());

        return $this->renderWithExtraParams('@CompoSonataAdmin/CRUD/trash.html.twig', [
            'action' => 'trash',
            'form' => $formView,
            'datagrid' => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ]);
    }
1348970
public function get_dirty() {
		$dirty = [];

		foreach ( $this->get_attributes() as $key => $value ) {
			if ( ! $this->original_is_equivalent( $key, $value ) ) {
				$dirty[ $key ] = $value;
			}
		}

		return $dirty;
	}
432308
public function excludeOnClone()
    {
        return [
            $this->model->getKeyName(),
            $this->model->getCreatedAtColumn(),
            $this->model->getUpdatedAtColumn(),
        ];
    }
1079738
public function select()
    {
        $query     = 'SELECT ' . $this->getQueryFields() . ' FROM ' . $this->getTable() . ' ' . $this->getQueryWhere() . ' ' . $this->getQueryOrderBy() . ' ' . $this->getQueryLimit();
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        $collection = array();

        while (false !== ($row = $statement->fetchObject())) {
            $collection[] = $this->newDataInstance($row, true);
        }

        return $collection;
    }
649070
public function clear()
    {
        $this->models = [];
        $this->modelKeyMap = [];
        $this->added = [];
        $this->removed = $this->original;
        return $this;
    }
619487
public function delete()
    {
        $ret = $this->conn()->selectCollection($this->table_name)->remove($this->where);
        $this->sql = array('table'=> $this->table_name,'where'=>$this->where);

        $this->_clear_var();
        return $ret;
    }
18731
public function getDirty()
    {
        $dirty = [];

        foreach ($this->getAttributes() as $key => $value) {
            if (! $this->originalIsEquivalent($key, $value)) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }
602766
public function clean()
    {
        $instance = $this->replicate();
        $instance->setVisible([]);
        $instance->setHidden([]);
        $instance->setAppends([]);

        return $instance;
    }
32284
public function getUnindexedFields()
    {
        $unindexedFields = array();
        $fields = $this->getFieldsInQuery();
        foreach ($fields as $field) {
            if ( ! $this->collection->isFieldIndexed($field)) {
                $unindexedFields[] = $field;
            }
        }
        return $unindexedFields;
    }
1193846
def clear(self):
        
        self._filters = []
        self._order_by = OrderedDict()
        self._selects = set()
        self._negation = False
        self._attribute = None
        self._chain = None
        self._search = None

        return self
810267
public function clear() {
        $this->nested = [];
        $this->getter = null;
        $this->setter = null;
        return $this;
    }
376590
protected function cleanPosition()
    {
        $modulesType = [];

        $this->moduleQuery->clear();
        $modules = $this->moduleQuery->orderByPosition(Criteria::ASC);

        /** @var \Thelia\Model\Module $module */
        foreach ($modules as $module) {
            if (!isset($modulesType[$module->getType()])) {
                $modulesType[$module->getType()] = 0;
            }

            $module
                ->setPosition(++$modulesType[$module->getType()])
                ->save()
            ;
        }

        return $modulesType;
    }
958887
public function revert()
    {
        $model = $this->getModel();
        unset( $model->{$model->getCreatedAtColumn()} );
        unset( $model->{$model->getUpdatedAtColumn()} );
        if (method_exists($model, 'getDeletedAtColumn')) {
            unset( $model->{$model->getDeletedAtColumn()} );
        }
        $model->save();
        return $model;
    }