lithium\data\model\Relationship::get()

public method

Gets a related object (or objects) for the given object connected to it by this relationship.

Parameters

  • object $object

    The object to get the related data for.

  • array $options

    Additional options to merge into the query to be performed, where applicable.

Returns

object

Returns the object(s) for this relationship.

Source

	public function get($object, array $options = []) {
		$link = $this->link();
		$strategies = $this->_strategies();

		if (!isset($strategies[$link]) || !is_callable($strategies[$link])) {
			$msg = "Attempted to get object for invalid relationship link type `{$link}`.";
			throw new ConfigException($msg);
		}
		return $strategies[$link]($object, $this, $options);
	}