Eccube\Entity\Category::hasProductCategories PHP Method

hasProductCategories() public method

ProductCategoriesはExtra Lazyのため, lengthやcountで評価した際にはCOUNTのSQLが発行されるが, COUNT自体が重いので, LIMIT 1で取得し存在チェックを行う.
See also: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-associations.html#filtering-collections
public hasProductCategories ( ) : boolean
return boolean
    public function hasProductCategories()
    {
        $criteria = Criteria::create()->orderBy(array('category_id' => Criteria::ASC))->setFirstResult(0)->setMaxResults(1);
        return $this->ProductCategories->matching($criteria)->count() === 1;
    }