コード例 #1
0
ファイル: ActiveRow.php プロジェクト: krecek/nrsn
	/**
	 * Returns referencing rows.
	 * @param  string
	 * @param  string
	 * @return NGroupedTableSelection
	 */
	public function related($key, $throughColumn = NULL)
	{
		if (strpos($key, '.') !== FALSE) {
			list($key, $throughColumn) = explode('.', $key);
		} elseif (!$throughColumn) {
			list($key, $throughColumn) = $this->table->getConnection()->getDatabaseReflection()->getHasManyReference($this->table->getName(), $key);
		}

		return $this->table->getReferencingTable($key, $throughColumn, $this[$this->table->getPrimary()]);
	}
コード例 #2
0
ファイル: ActiveRow.php プロジェクト: rinaldinoor/scoreBoard
	/**
	 * Returns referencing rows.
	 * @param  string
	 * @param  string
	 * @return NGroupedTableSelection
	 */
	public function related($key, $throughColumn = NULL)
	{
		if (strpos($key, '.') !== FALSE) {
			list($key, $throughColumn) = explode('.', $key);
		}

		list($table, $column) = $this->table->connection->databaseReflection->getHasManyReference($this->table->name, $key);
		$column = ($tmp=$throughColumn) ? $tmp : $column;
		$referencing = $this->table->getReferencingTable($table, $column);
		$referencing->active = $this[$this->table->primary];
		return $referencing;
	}