Adds the category and additional parameters to a query string.

@param string $category
@param string $and

@return string
351950
private function where($category, $and = '')
    {
        if (!empty($category)) {
            $sql = array();
            foreach ((array) $category as $like) {
                $sql[] = "c.category LIKE '{$like}%'";
            }
            $category = 'AND '.implode(' OR ', $sql);
        }

        return trim('INNER JOIN sitemap AS m INNER JOIN categories AS c WHERE s.docid = m.docid AND m.category_id = c.id '.$category.' '.$and);
    }
1056780
public static function createFromCategory(Category $category): self
    {
        $message = new self();
        $message->setId($category->getId());
        $message->setEnabled($category->isEnabled());

        foreach ($category->getTranslations() as $translation) {
            $transMessage = CategoryTranslationMessage::createFromCategoryTranslation($translation);

            $message->addTranslation($transMessage);
        }

        return $message;
    }
1088239
public function inCategory(string $category, string $domain = ''): self
    {
        $this->categories[] = ['category' => $category, 'domain'   => $domain];
        return $this;
    }
883143
public function addCategory($category)
    {
        if (!($category instanceof Category)) {
            $category = new Category($category);
        }
        $this->categories[] = $category;
    }
146629
protected function prepareMetadata(array $category)
    {

        // initialize the metadata
        $metadata = array();

        // query whether or not, the passed category IS the root category
        if ($this->isRootCategory($category)) {
            return;
        }

        // if not, set the category ID in the metadata
        $metadata[UrlRewriteObserver::CATEGORY_ID] = (integer) $category[MemberNames::ENTITY_ID];

        // return the metadata
        return $metadata;
    }
1014854
protected function addSeparator($and) {
        if ($and) {
            $separator = $this->operationSeparator .
                    $this->getDriverEscaper()->dbCommand('UNION') . ' ' .
                    $this->getDriverEscaper()->dbCommand('ALL') .
                    $this->operationSeparator;
        } else {
            $separator = $this->closeOperation() .
                    $this->operationSeparator .
                    $this->getDriverEscaper()->dbCommand('UNION') .
                    $this->operationSeparator .
                    $this->queryPrefix;

            $this->predicateLoop = 0;
        }
        $this->query .= ' ' . $separator . ' ';
        return $this;
    }
806852
public function scopeFilterCategories($query, $categories)
    {
        return $query->whereHas('categories', function($q) use ($categories) {
            $q->whereIn('id', $categories);
        });
    }
1359886
public function getPostsByCategory($category)
    {
        if (false === array_key_exists($category, $this->categoryIndex)) {
            return [];
        }

        $postNames = $this->categoryIndex[$category];

        return $this->getPostsByName($postNames);
    }
40371
public function addCategory(BlogCategory $category)
    {
        $category->setBlog($this);
        $this->categories->add($category);

        return $this;
    }
129893
public function addAnd($expression)
    {
        $this->query['$and'][] = $expression instanceof Expr ? $expression->getQuery() : $expression;
        return $this;
    }
611758
public function getQueryFilter(CategoryInterface $category)
    {
        $queryParams       = ['field' => 'category.category_id', 'value' => $category->getId()];
        $query             = $this->queryFactory->create(QueryInterface::TYPE_TERM, $queryParams);
        $nestedQueryParams = ['query' => $query, 'path' => 'category'];

        return $this->queryFactory->create(QueryInterface::TYPE_NESTED, $nestedQueryParams);
    }
240059
protected function submitAddCategory()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('category');
        $this->addCategory();
    }
208701
public function ancestorsOf(ChildCategory $category)
    {
        return $this
            ->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::LESS_THAN)
            ->addUsingAlias(ChildCategory::RIGHT_COL, $category->getRightValue(), Criteria::GREATER_THAN);
    }
1140395
public function setCategory(\Amulen\ClassificationBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }
653207
public function addCategory(\Enhavo\Bundle\CategoryBundle\Entity\Category $category)
    {
        $category->setCollection($this);
        $this->categories[] = $category;

        return $this;
    }
728324
public function descendantsOf(ChildCategory $category)
    {
        return $this
            ->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::GREATER_THAN)
            ->addUsingAlias(ChildCategory::LEFT_COL, $category->getRightValue(), Criteria::LESS_THAN);
    }
953466
public function addAnd($expression, ...$expressions) : self
    {
        if (! isset($this->expr['$and'])) {
            $this->expr['$and'] = [];
        }

        $this->expr['$and'] = array_merge($this->expr['$and'], array_map([$this, 'ensureArray'], func_get_args()));

        return $this;
    }