public function addCondition($column, $value) { $this->release(); $condition = $this->getParser()->parse($column, $value, $this->builder); $this->builder->addWhere($condition, $value); if ($condition !== $column) { $this->distinct = TRUE; } return $this; }
protected function fetch(SqlBuilder $builder, $hasJoin, array $values) { $primaryKey = $this->targetRepository->getMapper()->getStorageReflection()->getStoragePrimaryKey()[0]; $builder->addWhere($primaryKey, $values); $builder->addSelect(($hasJoin ? 'DISTINCT ' : '') . $builder->getTableName() . '.*'); $result = $this->context->queryArgs($builder->buildSelectQuery(), $builder->getParameters()); $entities = []; while ($data = $result->fetch()) { $entity = $this->targetRepository->hydrateEntity((array) $data); $entities[$entity->id] = $entity; } return new EntityContainer($entities); }
public function remove(IEntity $parent, array $remove) { $this->mapperOne->beginTransaction(); $list = $this->buildList($parent, $remove); $builder = new SqlBuilder($this->joinTable, $this->context); $builder->addWhere(array_keys(reset($list)), $list); $this->context->queryArgs($builder->buildDeleteQuery(), $builder->getParameters()); }