Check if this record exists on the draft stage

@return bool
773970
public function isOnDraft()
    {
        $id = $this->owner->ID ?: $this->owner->OldID;
        if (!$id) {
            return false;
        }
        if (!$this->hasStages()) {
            return true;
        }

        $draftVersion = static::get_versionnumber_by_stage($this->owner, Versioned::DRAFT, $id);
        return (bool)$draftVersion;
    }
1138450
public function hasPlaceholder()
    {
        if ($this->preferredChoices) {
            $firstChoice = reset($this->preferredChoices);

            return $firstChoice instanceof ChoiceView && '' === $firstChoice->value;
        }

        $firstChoice = reset($this->choices);

        return $firstChoice instanceof ChoiceView && '' === $firstChoice->value;
    }
785069
protected function isSelected(): bool
    {
        $key = $this->choices[$this->line]['key'];
        return array_key_exists($key, $this->selections);
    }
243661
public function hasIncrementField(): bool
    {
        $fields = $this->getFields();

        foreach ($this->data as $key => $datum) {
            if (isset($fields[$key]) && $fields[$key]->Extra === 'auto_increment') {
                return true;
            }
        }

        return false;
    }
365621
public function exists()
    {
        $indexValue = $this->getFieldValue($this->getIndex());
        if ($indexValue) {
            return $this->get($indexValue)->count() > 0;
        }
        return false;
    }
948396
public function exists(){
		if($this->from_db)
		{
            foreach ($this->identifiers as $id) {
                if(!isset($this->properties[$id]))
                    return false;
            }
            return true;
       }
       return false;
    }
879608
public function exists()
    {
        $quotedTable = \Database\DatabaseConnectionFactory::get()->quote($this->getTable());
        $record = \Database\DatabaseConnectionFactory::get()->query("show tables like {$quotedTable}");
        return !is_a($record, 'Database\DatabaseRecord\EmptyDatabaseRecord') && count($record->all()) > 0;
    }
41267
public function hasOptionsForm()
    {
        $env = Environment::get();
        $rec = $env->getRecord(
            DIRNAME_ELEMENTS . '/' . DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' .
            $this->cnvEditorHandle . '/' . FILENAME_CONVERSATION_EDITOR_OPTIONS,
            $this->getPackageHandle()
        );

        return $rec->exists();
    }
470761
public function has_overrides() {
        global $DB;

        $override = $DB->record_exists('assign_overrides', array('assignid' => $this->get_instance()->id));

        if ($override) {
            return true;
        }

        return false;
    }
675531
public function record(): bool
    {
        if ($this->shouldRecord()) {
            $view = app(ViewContract::class);
            $view->viewable_id = $this->viewable->getKey();
            $view->viewable_type = $this->viewable->getMorphClass();
            $view->visitor = $this->resolveVisitorId();
            $view->collection = $this->collection;
            $view->viewed_at = Carbon::now();

            return $view->save();
        }

        return false;
    }
121028
public function exists()
    {
        try {
            $this->connection->getDataset($this->identity + ['fields' => 'datasetReference']);
        } catch (NotFoundException $ex) {
            return false;
        }

        return true;
    }
1024529
public function can_read() {
        if ($this->is_draft()) {
            return self::can_read_user_draft($this->get('userid'));
        }
        return self::can_read_user($this->get('userid'));
    }
874272
public function contentExists() {
		$r = Catalog::getRoot();
		if (count($r->children) > 1) return true;
		if (count($r->children) < 1) return false;
		
		$s = $r->children[0];
		
		if (count($s->children)) return true;
		if (count($s->getMaterials()->unpublished())) return true;
		
		return false;
	}
742264
protected function exists($shortname = null) {
        global $DB;
        if (is_null($shortname)) {
            $shortname = $this->shortname;
        }
        if (!empty($shortname) || is_numeric($shortname)) {
            return $DB->record_exists('course', array('shortname' => $shortname));
        }
        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;
    }
556153
public function exists(int $id) : bool {
        global $DB;
        return $DB->record_exists($this->favouritetable, ['id' => $id]);
    }
147287
public function exists(): bool
    {
        if ($this->caching == false) {
            return file_exists($this->getAbsoluteFilePath());
        }

        if ($this->exists == null) {
            $this->exists = file_exists($this->getAbsoluteFilePath());
        }

        return $this->exists;
    }