Checks if the current Model exists in the storage.

@return bool
763828
public function exists() : bool
    {
        $query = static::createQuery();
        $pks = static::getPrimaryKeys();
        $pkValues = $this->getPrimaryKeyValues();

        if (count($pks) != count($pkValues)) {
            return false;
        }

        $filterFunction = function (WhereClause $whereClause) use (&$pkValues, $query) {
            foreach ($pkValues as $field => $value) {
                $whereClause->and($field, '=', '?');
                $query->bind($value);
            }
        };
        $query->where($filterFunction)
            ->count('*');

        $row = $query->execute()->fetch();

        return $row['all_count'] > 0;
    }
1197515
public function reload(): bool
	{
		if($this->isPersisted)
		{
			$model = static::get($this->getPrimaryKeyValue());

			if($model !== false)
			{
				$this->original = $this->columns = $model->getRawColumnValues();

				$this->related = $model->getRelated();

				return true;
			}
		}

		return false;
	}
454185
public function exists()
    {
        try {
            $path = $this->getPrefix();

            if ($this->getFileSystem()->has($path)) {
                $metadata = $this->getFileSystem()->getMetadata($this->getPrefix());
                return $metadata['type'] === 'file';
            }
        } catch (FileNotFoundException $e) {
        }
        return false;
    }
553342
public function hasTabs(): bool
    {
        if ( ! $this->layout || ! count($this->layout)) {
            return false;
        }

        foreach ($this->layout as $key => $value) {

            if ($value instanceof ModelFormTabDataInterface) {
                return true;
            }
        }

        return false;
    }
1083867
public function existsFile() {
		$file =$this->getPath();
		if (file_exists($file)) {
			if ($this->type == self::TYPE_ENTITY) {
				return self::FILE_MATCH;
			}
			
			$data = file_get_contents($file);
			if (strpos($data, "@version ".Version::BUILDER_VERSION) !== FALSE) {
				return self::FILE_MATCH;
			} else {
				return self::FILE_OUTDATED;
			}
		}
		return self::FILE_MISSING;
	}
761716
private function filesExist()
    {
        foreach (static::FILES as $file) {
            if (!file_exists($this->storage($file))) {
                return false;
            }
        }

        return true;
    }
193766
public function has_active_instances() {
        global $DB;
        if (empty($this->definition->id)) {
            return false;
        }
        if ($this->hasactiveinstances === null) {
            $conditions = array('definitionid'  => $this->definition->id,
                        'status'  => gradingform_instance::INSTANCE_STATUS_ACTIVE);
            $this->hasactiveinstances = $DB->record_exists('grading_instances', $conditions);
        }
        return $this->hasactiveinstances;
    }
498027
protected function hasModelValue($name)
    {
        if (!isset($this->model)) {
            return false;
        }

        return isset($this->model->{$name});
    }
854158
public function isCurrent()
    {
        $currentPage = Director::get_current_page();

        if ($currentPage instanceof ContentController) {
            $currentPage = $currentPage->data();
        }
        if ($currentPage instanceof CatalogueCategory || $currentPage instanceof CatalogueProduct) {
            return $currentPage === $this->owner || $currentPage->ID === $this->owner->ID;
        }
        return false;
    }
780026
public function exists()
    {
        $returnValue = (bool) false;
        try{
        	$returnValue = count($this->getTypes())?true:false;
        }
        catch(Exception $e){
        	;//return false by default
        }
        return (bool) $returnValue;
    }
1300319
public function blobExists()
    {
        if ($this->blob->path . '' === '') {
            return true;
        }

        return $this->storage->exists($this->blob->path);
    }
249148
public function hasChanged()
    {
        foreach ($this->modelData as $property => $value) {
            if ($this->hasPropertyChanged($property)) {
                return true;
            }
        }

        // In case model data has been manually unset
        $manuallyUnsetProperties = array_diff_key($this->changeSnapshotData, $this->modelData);
        foreach ($manuallyUnsetProperties as $property => $value) {
            // If it wasn't null before, that's a change
            if ($value !== null) {
                return true;
            }
        }

        return false;
    }
1154917
public function exists()
	{
		if ($this->isExternal())
		{
			return true;
		}

		if ($this->declaration && $this->name)
		{
			return true;
		}

		if ($this->targetPath() && file_exists($this->targetPath()))
		{
			return true;
		}

		return false;
	}
787210
public static function exists() : bool
    {
        // Start session if needed
        if (! session_id()) {
            Session::start();
        }

        // Loop all arguments
        foreach (func_get_args() as $argument) {

            // Array element
            if (is_array($argument)) {

                // Loop the keys
                foreach ($argument as $key) {

                    // Does NOT exist
                    if (! isset($_SESSION[(string) $key])) {
                        return false;
                    }
                }
            } else {

                // Does NOT exist
                if (! isset($_SESSION[(string) $argument])) {
                    return false;
                }
            }
        }

        return true;
    }
678610
protected function isSaved(): bool
    {
        return $this->filesystem->has($this->path)
            && $this->filesystem->getTimestamp($this->path) > $this->file->getUpdatedAt();
    }
768963
public function cacheExists()
    {
        $cacheFile = $this->getCacheFile();
        if (file_exists($cacheFile) && filemtime($cacheFile) > (time()-$this->cachePeriod)) {
            return(true);
        } else {
            return(false);
        }
    }
771590
public function isModified()
    {
        if ($this->read_only) {
            return false;
        }

        foreach ($this->getProperties() as $name => $value) {
            $hashed_value = $this->getHashValue($value);
            if (
                isset($this->property_hashes[$name]) &&
                $hashed_value !== $this->property_hashes[$name]
            ) {
                return true;
            }
        }

        foreach ($this->internal_property_autosave as $name => $autosave) {
            if ($autosave && isset($this->sub_data_objects[$name])) {
                $object = $this->sub_data_objects[$name];
                if (
                    $object instanceof SwatDBRecordable &&
                    $object->isModified()
                ) {
                    return true;
                }
            }
        }

        foreach ($this->sub_data_objects as $name => $object) {
            $saver_method =
                'save' . str_replace(' ', '', ucwords(strtr($name, '_', ' ')));

            if (method_exists($this, $saver_method)) {
                $object = $this->sub_data_objects[$name];
                if (
                    $object instanceof SwatDBRecordable &&
                    $object->isModified()
                ) {
                    return true;
                }
            }
        }

        return false;
    }