Returns a new LicenseQuery object.

@param     string $modelAlias The alias of a model in the query
@param   LicenseQuery|Criteria $criteria Optional Criteria to build the query from

@return LicenseQuery
964329
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof LicenseQuery) {
            return $criteria;
        }
        $query = new LicenseQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
1346579
public function leftJoin($table, $criteria = null, $alias = null)
    {
        return $this->join($table, $criteria, self::LEFT_JOIN, $alias);
    }
1276803
public function GetCustomQuery($objectclass, $criteria)
	{
		$this->IncludeModel($objectclass);
		$sql = call_user_func( array($objectclass,"GetCustomQuery"),$criteria );
		return $sql;
	}
110361
public function registerCriteriaFunction($criteria) {

        $id = \uniqid('criteria');

        if (\is_callable($criteria)) {
           $this->document_criterias[$id] = $criteria;
           return $id;
        }

        if (is_array($criteria)) {

            $fn = null;

            eval('$fn = function($document) { return '.UtilArrayQuery::buildCondition($criteria).'; };');

            $this->document_criterias[$id] = $fn;

            return $id;
        }

        return null;
    }
1183678
public function createQueryBuilder($alias, $indexBy = null) {
        return $this->getEntityManager()->createQueryBuilder()
            ->select($alias)
            ->from($this->getEntityName(), $alias, $indexBy);
    }
1069765
public function findBy(
        string $modelClass,
        array $criteria,
        array $orderBy = null,
        int $limit = null,
        int $offset = null
    ): array {
        return $this->getRepositoryByClass($modelClass)->findBy($criteria, $orderBy, $limit, $offset);
    }
647253
public function set(ModelInterface $model, $alias = null)
    {
        $hash = spl_object_hash($model);

        $this->collection[$hash] = &$model;

        if ($alias !== null) {
            $this->byAlias[$model->alias($alias)] = &$this->collection[$hash];
        }

        $this->byEntity[$this->normalizeNamespace($model->entity())] = &$this->collection[$hash];

        return $this;
    }
938729
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof ApiLogQuery) {
            return $criteria;
        }
        $query = new ApiLogQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
453824
public function getQuery($criteria = [])
    {

        /** @var ElementInterface $elementClass */
        $elementClass = static::elementClass();

        /** @var ElementQueryInterface $query */
        $query = $elementClass::find();

        // Configure it
        QueryHelper::configure(
            $query,
            $criteria
        );

        return $query;
    }
494257
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof \SmartyFilter\Model\SmartyFilterQuery) {
            return $criteria;
        }
        $query = new \SmartyFilter\Model\SmartyFilterQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
337679
@SuppressWarnings("unchecked")
  public static <E> OqlBuilder<E> from(final String entityName, final String alias) {
    EntityType type = Model.getType(entityName);
    OqlBuilder<E> query = new OqlBuilder<E>();
    if (null != type) query.entityClass = (Class<E>) type.getEntityClass();
    query.alias = alias;
    query.select = "select " + alias;
    query.from = concat("from ", entityName, " ", alias);
    return query;
  }
910037
public function init(ModelCriteria $criteria)
    {
        $this->dbName = $criteria->getDbName();
        $this->setClass($criteria->getModelName());
        $this->setWith($criteria->getWith());
        $this->asColumns = $criteria->getAsColumns();
        $this->hasLimit = $criteria->getLimit() != 0;

        return $this;
    }
823454
public static function query($alias = null, $model = null)
    {
        if (!$model) {
            $model = Di::getDefault()->getShared(static::class);
        }

        return $model->_di->get('ManaPHP\Mongodb\Query')->setModel($model)->setTypes($model->getFieldTypes());
    }
423610
public function get($alias)
    {
        $alias = $this->normalizeNamespace($alias);

        if (isset($this->byAlias[$alias])) {
            return $this->byAlias[$alias];
        }

        if (isset($this->byEntity[$alias])) {
            return $this->byEntity[$alias];
        }

        throw new ModelException(sprintf('Model for entity "%s" does not exists', $alias));
    }
1233668
protected function applyAliasFilters(ModelQueryBuilder $builder): self
    {
        if ($this->hasFilters() === true) {
            $filters = $this->getFilters();
            $this->areFiltersWithAnd() === true ?
                $builder->addFiltersWithAndToAlias($filters) : $builder->addFiltersWithOrToAlias($filters);
        }

        return $this;
    }
986509
public function findOrCreate($criteria, $parameters = null)
    {
        if ($criteria instanceof Bag) {
            $criteria = $criteria->toArray();
        }

        if ($parameters === null) {
            $parameters = $criteria;
        }

        $parameters = $this->castParameters($parameters);
        $entity = $this->getRepository()->findOneBy($criteria);

        if ($entity == null) {
            return $this->create($parameters);
        }

        $result = new Result();
        $result->getResources()->push($entity);

        return $result;
    }
90269
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof SystemSettingsQuery) {
            return $criteria;
        }
        $query = new SystemSettingsQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }