Overview

Namespaces

  • App
    • Components
    • Interfaces
    • Lib
      • Files
      • Forms
        • Controls
      • Html
      • Repair
      • Statics
    • Model
    • Modules
      • BaseModule
        • Presenters
      • PartnersModule
        • Presenters
      • ProductModule
        • Presenters
      • SaleModule
        • Model
        • Presenters
      • SettingsModule
        • Model
        • Presenters
      • StoreModule
        • Model
        • Presenters
    • Presenters
    • Router
  • PHP

Classes

  • DateTime
  • SplFileInfo

Interfaces

  • ArrayAccess
  • Countable
  • Exception
  • Iterator
  • Traversable
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download
 1: <?php
 2: 
 3: /**
 4:  * Project sberp
 5:  *
 6:  * @file Relation 
 7:  * @author Jaromír Polášek
 8:  * verze: 0.7.5.RELATION
 9:  * Encoding UTF-8
10:  */
11: 
12: namespace App\Lib\Forms;
13: 
14: use Nette\Object,
15:     App\Model\Database,
16:     App\Lib\Statics\Cons;
17: 
18: /**
19:  * Vytváří obsahy pro potřeby relací
20:  */
21: class Relation extends Object{
22:     
23:     private $database;
24:     
25:     /**
26:      * Vytvoří spojení na databázi
27:      * @param Database $database
28:      */
29:     public function __construct(Database $database) {
30:     $this->database = $database;
31:     }
32:     
33:     /**
34:      * Vrátí data pro potřeby relace
35:      * @param string $table
36:      * @param string $column
37:      * @return array
38:      */
39:     public function getRelation($table, $column){
40:     return (new Table(rtrim(strtolower($table), '_id'), $this->database))->data->fetchPairs($column, Cons::COLUMN_ID);
41:     }       
42: }
43: 
sberp API API documentation generated by ApiGen