Filters by type of collection (using the ID field).

@param mixed $ptID
556130
public function filterByPageTypeID($ptID)
    {
        $this->filterByPageType = true;
        $db = Loader::db();
        if (is_array($ptID)) {
            $cth = '(';
            for ($i = 0; $i < count($ptID); ++$i) {
                if ($i > 0) {
                    $cth .= ',';
                }
                $cth .= $db->quote($ptID[$i]);
            }
            $cth .= ')';
            $this->filter(false, "(pt.ptID in {$cth})");
        } else {
            $this->filter("pt.ptID", $ptID);
        }
    }
383043
public function hasCollectionAnyItemsByWebsiteAndType($websiteId, $type, $ruleId = false)
    {
        $collection = $this->addFieldToFilter('type', ['eq' => $type])
            ->addFieldToFilter('website_ids', ['finset' => $websiteId]);

        if ($ruleId) {
            $collection->addFieldToFilter('id', ['neq' => $ruleId]);
        }
        $collection->setPageSize(1);

        if ($collection->getSize()) {
            return false;
        }

        return true;
    }
1216430
public function byId($id)
    {
        if ($id instanceof \MongoId) {
            $this->expression->where('_id', $id);
        } else {
            try {
                $this->expression->where('_id', new \MongoId($id));
            } catch (\MongoException $e) {
                $this->expression->where('_id', $id);
            }
        }

        return $this;
    }
1233756
protected function doFind(array $id, \Owl\Service $service = null, $collection = null)
    {
        if ($record = $this->getCache($id)) {
            return isset($record['__IS_NOT_FOUND__']) ? false : $record;
        }

        if ($record = parent::doFind($id, $service, $collection)) {
            $record = $this->removeNullValues($record);
            $this->saveCache($id, $record);
        } else {
            $policy = $this->getCachePolicy();

            if ($ttl = $policy['not_found']) {
                $ttl = is_numeric($ttl) ? (int) $ttl : null;
                $this->saveCache($id, ['__IS_NOT_FOUND__' => 1], $ttl);
            }
        }

        return $record;
    }
534489
public function setTypeId( $typeId )
	{
		if ( $typeId == $this->getTypeId() ) { return; }

		$this->_values['typeid'] = (int) $typeId;
		$this->setModified();
	}
366375
public function remove($id)
    {
        if ($this->has($id) === false) {
            return;
        }

        $collection = $this->idCollections[$id];

        unset($this->idCollections[$id]);
        unset($this->itemCollections[$collection]);
        unset($this->items[$id]);
    }
53317
protected function collection_query( &$collection ) 
	{
		$local_keys = array();
		
		foreach( $collection as $item )
		{
			$local_keys[] = $item->raw( $this->local_key );
		}
		
		// set the correct collection where
		$this->query->wheres = array();
		$this->query->where( $this->foreign_key, 'in', $local_keys );
		$this->query->group_result( $this->foreign_key );
		
		$this->query->limit( null );
	}
1356265
public function setTypeId( $id )
	{
		$id = (int) $id;
		if ( $id === $this->getTypeId() ) { return; }

		$this->_values['typeid'] = (int) $id;
		$this->setModified();
	}
657352
public function forForeignID($id)
    {
        // Turn a 1-element array into a simple value
        if (is_array($id) && sizeof($id) == 1) {
            $id = reset($id);
        }

        // Calculate the new filter
        $filter = $this->foreignIDFilter($id);

        $list = $this->alterDataQuery(function (DataQuery $query) use ($id, $filter) {
            // Check if there is an existing filter, remove if there is
            $currentFilter = $query->getQueryParam('Foreign.Filter');
            if ($currentFilter) {
                try {
                    $query->removeFilterOn($currentFilter);
                } catch (Exception $e) {
                    /* NOP */
                }
            }

            // Add the new filter
            $query->setQueryParam('Foreign.ID', $id);
            $query->setQueryParam('Foreign.Filter', $filter);
            $query->where($filter);
        });

        return $list;
    }
1052198
public function wherePK($id): self
    {
        if (empty($this->loader->primaryKey())) {
            //This MUST never happen due ORM requires PK now for every entity
            throw new SelectorException("Unable to set wherePK condition, no proper PK were defined");
        }

        //Adding condition to initial query
        $this->loader->initialQuery()->where([
            //Must be already aliased
            $this->loader->primaryKey() => $id
        ]);

        return $this;
    }
872356
public function getCollectionById($collectionId)
    {
        $collection = $this->collectionRepository->find($collectionId);
        if (!$collection) {
            throw new CollectionNotFoundException($collectionId);
        }

        return $collection;
    }
293940
protected function _loadById($objectId)
    {
        if ($objectId == 'lastInsertedId') {
            $objectId = $this->_getLastInsertedId();
        }
        $object = $this->getObject();
        $result = $object->load($objectId);

        if ($result && $object->getId() != $objectId) {
            $result = $object->load($objectId);
        }

        return $result;
    }
449847
static function removeCollection( $collectionID )
    {
        if( !is_numeric( $collectionID ) )
        {
            return;
        }

        $db = eZDB::instance();

        $db->query( "DELETE FROM ezinfocollection
                     WHERE id = '$collectionID'" );
        $db->query( "DELETE FROM ezinfocollection_attribute
                     WHERE informationcollection_id = '$collectionID'" );
    }
1023275
def filter(self, *args, **kwargs):
		""""""
		if 'pk' in kwargs or 'id' in kwargs:
			return self.all_with_deleted().filter(*args, **kwargs)
		return self.get_query_set().filter(*args, **kwargs)
241747
public void setCollectionIds(java.util.Collection<String> collectionIds) {
        if (collectionIds == null) {
            this.collectionIds = null;
            return;
        }

        this.collectionIds = new java.util.ArrayList<String>(collectionIds);
    }
105105
public function where($id)
    {
        $this->validateIdentifier($id);

        if (!is_array($id)) {
            $key = reset($this->keys);
            return [$key => $id];
        } else {
            return $id;
        }
    }
1260360
public static function isPageForPostType($postId)
    {
        $postType = get_post_type($postId);
        $option = get_option('page_for_' . $postType);
        $pageContent = get_option('page_for_' . $postType . '_content');

        if ($option && $option === $postId && !$pageContent) {
            return $postType;
        }
        return false;
    }