getReferencingTable() public method

Returns referencing rows.
public getReferencingTable ( $table, $column, $active = NULL ) : GroupedSelection
return GroupedSelection
Beispiel #1
0
 /**
  * Returns referencing rows.
  * @param  string
  * @param  string
  * @return GroupedSelection
  */
 public function related($key, $throughColumn = NULL)
 {
     if (strpos($key, '.') !== FALSE) {
         list($key, $throughColumn) = explode('.', $key);
     }
     list($table, $column) = $this->table->getConnection()->getDatabaseReflection()->getHasManyReference($this->table->getName(), $key);
     return $this->table->getReferencingTable($table, $throughColumn ?: $column, $this[$this->table->getPrimary()]);
 }
Beispiel #2
0
 /**
  * Returns referencing rows.
  * @param  string
  * @param  string
  * @return GroupedSelection
  */
 public function related($key, $throughColumn = NULL)
 {
     $groupedSelection = $this->table->getReferencingTable($key, $throughColumn, $this[$this->table->getPrimary()]);
     if (!$groupedSelection) {
         throw new Nette\MemberAccessException("No reference found for \${$this->table->name}->related({$key}).");
     }
     return $groupedSelection;
 }
 /**
  * Returns referencing rows.
  *
  * @param  string
  * @param  string
  *
  * @return GroupedSelection
  */
 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()]);
 }
Beispiel #4
0
 /**
  * Returns referencing rows.
  * @param  string
  * @param  string
  * @param  bool
  * @return GroupedSelection
  */
 public function related($key, $throughColumn = NULL, $forceNewInstance = FALSE)
 {
     if (strpos($key, '.') !== FALSE) {
         list($key, $throughColumn) = explode('.', $key);
     } elseif (!is_string($throughColumn)) {
         list($key, $throughColumn) = $this->table->getConnection()->getDatabaseReflection()->getHasManyReference($this->table->getName(), $key);
     }
     return $this->table->getReferencingTable($key, $throughColumn, $this[$this->table->getPrimary()], $forceNewInstance);
 }
Beispiel #5
0
 /**
  * Returns referencing rows.
  * @param  string table name
  * @return GroupedSelection
  */
 public function related($table)
 {
     $referencing = $this->table->getReferencingTable($table);
     $referencing->active = $this[$this->table->primary];
     return $referencing;
 }