Submission_Value

Class representing a submission value.

Description

Source

File: src/db-objects/submission-values/submission-value.php

class Submission_Value extends Model {
	use Sitewide_Model_Trait;

	/**
	 * Submission value ID.
	 *
	 * @since 1.0.0
	 * @var int
	 */
	protected $id = 0;

	/**
	 * ID of the submission this submission value is part of.
	 *
	 * @since 1.0.0
	 * @var int
	 */
	protected $submission_id = 0;

	/**
	 * Element ID this submission value applies to.
	 *
	 * @since 1.0.0
	 * @var int
	 */
	protected $element_id = 0;

	/**
	 * Element field this submission value is for.
	 *
	 * @since 1.0.0
	 * @var string
	 */
	protected $field = '';

	/**
	 * Submission value.
	 *
	 * @since 1.0.0
	 * @var string
	 */
	protected $value = '';

	/**
	 * Returns the parent submission for the submission value.
	 *
	 * @since 1.0.0
	 *
	 * @return Submission|null Parent submission, or null if none set.
	 */
	public function get_submission() {
		if ( empty( $this->submission_id ) ) {
			return null;
		}

		return $this->manager->get_parent_manager( 'submissions' )->get( $this->submission_id );
	}
}

Changelog

Changelog
Version Description
1.0.0 Introduced.

Methods

  • get_submission — Returns the parent submission for the submission value.