Overview

Namespaces

  • GLFramework
    • Cache
    • Controller
    • DaMa
      • Manipulators
    • Database
    • HTTP
    • Mail
    • Middleware
    • Model
    • Module
    • Tests
    • Upload
    • Utils
  • None

Classes

  • GLFramework\Bootstrap
  • GLFramework\Cache\Cache
  • GLFramework\Cache\MemcachedCache
  • GLFramework\Cache\MemoryCache
  • GLFramework\Controller
  • GLFramework\Controller\AdminController
  • GLFramework\Controller\APIController
  • GLFramework\Controller\AuthController
  • GLFramework\Controller\ErrorController
  • GLFramework\Controller\ExceptionController
  • GLFramework\DaMa\Association
  • GLFramework\DaMa\DataManipulation
  • GLFramework\DaMa\Manipulator
  • GLFramework\DaMa\Manipulators\CSVManipulator
  • GLFramework\DaMa\Manipulators\ManipulatorCore
  • GLFramework\DaMa\Manipulators\XLSManipulator
  • GLFramework\DaMa\Manipulators\XLSXManipulator
  • GLFramework\Database\Connection
  • GLFramework\Database\MySQLConnection
  • GLFramework\DatabaseManager
  • GLFramework\DBStructure
  • GLFramework\Events
  • GLFramework\Filesystem
  • GLFramework\HTTP\API
  • GLFramework\Log
  • GLFramework\Mail
  • GLFramework\Mail\Mail
  • GLFramework\Mail\MailSystem
  • GLFramework\Mail\PHPMailer
  • GLFramework\MailView
  • GLFramework\Middleware\APIAuthorizationMiddleware
  • GLFramework\Middleware\ControllerMiddleware
  • GLFramework\Model
  • GLFramework\Model\Page
  • GLFramework\Model\User
  • GLFramework\Model\UserPage
  • GLFramework\ModelResult
  • GLFramework\Module\Module
  • GLFramework\Module\ModuleManager
  • GLFramework\Request
  • GLFramework\Response
  • GLFramework\Tests\DatabaseTestCase
  • GLFramework\Tests\TestCase
  • GLFramework\Upload\Upload
  • GLFramework\Upload\Uploads
  • GLFramework\Utils\DataTablesManager
  • GLFramework\Versions
  • GLFramework\View

Interfaces

  • GLFramework\Middleware

Functions

  • array_merge_recursive_ex
  • e
  • file_get_php_classes
  • fix_date
  • fix_date_format
  • fix_decimal
  • fix_url
  • get
  • get_php_classes
  • http_response_code
  • instance_method
  • is_module_enabled
  • now
  • post
  • print_array
  • print_brief_debug
  • print_debug
  • random_str
  • reArrayFiles
  • reArrayPost
  • today
  • Overview
  • Namespace
  • Class
  1: <?php
  2: /**
  3:  * Created by PhpStorm.
  4:  * User: manus
  5:  * Date: 10/03/16
  6:  * Time: 16:23
  7:  */
  8: 
  9: namespace GLFramework\DaMa;
 10: 
 11: 
 12: use GLFramework\Model;
 13: 
 14: class Association
 15: {
 16:     public $nameInFile = array();
 17:     public $nameInModel;
 18:     public $constant = false;
 19:     public $index = false;
 20:     public $parser = null;
 21: 
 22:     /**
 23:      * @return mixed
 24:      */
 25:     public function getNameInFile()
 26:     {
 27:         return $this->nameInFile;
 28:     }
 29: 
 30:     /**
 31:      * @param mixed $nameInFile
 32:      */
 33:     public function addNameInFile($nameInFile)
 34:     {
 35:         $this->nameInFile[] = $nameInFile;
 36:     }
 37: 
 38:     /**
 39:      * @return mixed
 40:      */
 41:     public function getNameInModel()
 42:     {
 43:         return $this->nameInModel;
 44:     }
 45: 
 46:     /**
 47:      * @param mixed $nameInModel
 48:      */
 49:     public function setNameInModel($nameInModel)
 50:     {
 51:         $this->nameInModel = $nameInModel;
 52:     }
 53: 
 54:     /**
 55:      * @return null
 56:      */
 57:     public function getParser()
 58:     {
 59:         return $this->parser;
 60:     }
 61: 
 62:     /**
 63:      * @param null $parser
 64:      */
 65:     public function setParser($parser)
 66:     {
 67:         $this->parser = $parser;
 68:     }
 69: 
 70:     /**
 71:      * @return boolean
 72:      */
 73:     public function isConstant()
 74:     {
 75:         return $this->constant;
 76:     }
 77: 
 78:     /**
 79:      * @param boolean $constant
 80:      */
 81:     public function setConstant($constant)
 82:     {
 83:         $this->constant = $constant;
 84:     }
 85: 
 86:     /**
 87:      * @param $model Model
 88:      * @param $row
 89:      * @return bool
 90:      */
 91:     public function fill($model, $row)
 92:     {
 93:         if(!$this->constant)
 94:         {
 95:             foreach($this->nameInFile as $subkey)
 96:             {
 97:                 if(isset($row[$subkey]))
 98:                 {
 99:                     $model->{$this->nameInModel} = $this->parse($row[$subkey]);
100:                     return true;
101:                 }
102:             }
103:         }
104:         else
105:         {
106:             $model->{$this->nameInModel} = $this->constant;
107:             return true;
108:         }
109:         return false;
110:     }
111: 
112:     private function parse($value)
113:     {
114:         if($this->parser != null)
115:         {
116:             return call_user_func($this->parser, $value);
117:         }
118:         return $value;
119:     }
120: 
121:     public function index()
122:     {
123:         $this->index = true;
124:         return $this;
125:     }
126: 
127: }
API documentation generated by ApiGen