__construct() protected method

Use the ORM::for_table factory method instead.
protected __construct ( $table_name, $data = [], $connection_name = self::DEFAULT_CONNECTION )
 function __construct($id = NULL)
 {
     parent::__construct($id);
     // if($this->id!=true) {
     // $this->where("web_type_id",1);
     // }
 }
Esempio n. 2
0
 public function __construct($data = [])
 {
     parent::__construct($data);
     if ($this->createdAt) {
         $this->createdAt = DateTime::createFromFormat('Y-m-d H:i:s', $this->createdAt);
     }
 }
Esempio n. 3
0
 public function __construct($id)
 {
     // load database library into $this->db (can be omitted if not required)
     parent::__construct($id);
     // Set the UNIX timestamp for use with the created field
     $this->now = time();
 }
 public function __construct($data)
 {
     parent::__construct();
     if ($data && sizeof($data)) {
         $this->populateFromRow($data);
     }
 }
Esempio n. 5
0
 /**
  * Load the default column names.
  *
  * @access  public
  * @param   mixed   parameter for find or object to load
  * @return  void
  */
 public function __construct($id = NULL)
 {
     if (!isset($this->_sorting)) {
         $this->_sorting = array($this->left_column => 'ASC');
     }
     parent::__construct($id);
 }
Esempio n. 6
0
 /**
  * Constructs a wrapper for a table.  Called by Model instances.
  */
 public function __construct($table_name)
 {
     self::_setup_db();
     parent::__construct($table_name);
     // Until find_one or find_many are called, this object is considered a new row
     $this->create();
 }
Esempio n. 7
0
 public function __construct($id = NULL)
 {
     parent::__construct($id);
     if (!$this->loaded()) {
         $this->payment_date = time();
     }
 }
Esempio n. 8
0
 public function __construct($id = null)
 {
     parent::__construct($id);
     if (!$this->loaded()) {
         // Set reasonable defaults
         $this->count = 0;
     }
 }
 public function __construct($id = NULL)
 {
     parent::__construct($id);
     $lat = Kohana::config('distance.lat');
     $lon = Kohana::config('distance.lon');
     $distance_calc = "(((acos(sin((" . $lat . "*pi()/180)) * sin((`PositionLat`*pi()/180))+cos((" . $lat . "*pi()/180)) * cos((`PositionLat`*pi()/180)) * cos(((" . $lon . "- `PositionLon`)*pi()/180))))*180/pi())*60*1.1515)";
     $this->sorting = array(array('column' => $distance_calc, 'direction' => 'ASC'));
 }
Esempio n. 10
0
 public function __construct($id = NULL)
 {
     parent::__construct($id);
     if (!$this->loaded()) {
         $this->created = time();
         /* Set a default status on new user creation */
         $this->status = Model_Account::ACCOUNT_STATUS_UNVERIFIED;
     }
 }
Esempio n. 11
0
 /**
  * Loads up a specific list table ORM instance
  * @param   string      name of the list to load
  * @return  Model_List
  */
 public function load($list_name)
 {
     $list = KMS::instance('site')->lists->where('name', '=', $list_name)->find();
     if (!$list->loaded()) {
         throw new KMS_Exception('Unable to load list `:list:`', array(':list:' => $list_name));
     }
     $this->_table_name = 'list_' . KMS::instance('site')->id . '_' . strtolower($list->name);
     parent::__construct($this->_passed_id);
     return $this;
 }
Esempio n. 12
0
 /**
  * Load the default column names
  *
  * @param   mixed  $id  Parameter for find or object to load [Optional]
  * @uses    Arr::unshift
  */
 public function __construct($id = NULL)
 {
     if (empty($this->_sorting)) {
         $this->_sorting = array($this->scope_column => 'ASC', $this->left_column => 'ASC');
     } else {
         $this->_sorting = Arr::unshift($this->_sorting, $this->left_column, 'ASC');
         $this->_sorting = Arr::unshift($this->_sorting, $this->scope_column, 'ASC');
     }
     parent::__construct($id);
 }
Esempio n. 13
0
 /**
  * Construct
  *
  * @param   mixed  $id
  * @return  void
  */
 public function __construct($id = null)
 {
     if (!is_object($this->cache)) {
         $this->cache = Cache::instance($this->cache);
     }
     if (empty($id)) {
         $id = null;
     }
     parent::__construct($id);
 }
Esempio n. 14
0
 /**
  * Load the default column names.
  *
  * @access  public
  * @param   mixed   parameter for find or object to load
  * @return  void
  */
 public function __construct($id = NULL)
 {
     $config = Kohana::config('mptt');
     foreach ($config as $param => $value) {
         $this->{$param} = $value;
     }
     if (!isset($this->_sorting)) {
         $this->_sorting = array($this->left_column => 'ASC');
     }
     parent::__construct($id);
 }
Esempio n. 15
0
 public function __construct($id = NULL)
 {
     try {
         // Check to see if the table exists
         return parent::__construct($id);
     } catch (Kohana_Exception $e) {
         // The table does not exist, lets create it
         self::create_table();
         return parent::__construct($id);
     }
 }
Esempio n. 16
0
 /**
  * Prepares the model database connection and loads the object.
  *
  * @param   mixed  parameter for find or object to load
  * @return  void
  */
 public function __construct($id = NULL)
 {
     $ret = parent::__construct($id);
     if (!$id || !$this->loaded) {
         $this->mod_time = time();
         $this->ip = Request::$client_ip;
         $this->method = Request::current()->controller() . '/' . Request::current()->action();
         if (Auth::instance()->is_logged_in()) {
             $this->modifier_id = Auth::instance()->getAccount()->id;
         }
     }
 }
Esempio n. 17
0
 /**
  * Handles garbage collection and deleting of expired objects.
  *
  * @return  void
  */
 public function __construct($id = null)
 {
     parent::__construct($id);
     if (mt_rand(1, 100) === 1) {
         // Do garbage collection
         $this->delete_expired();
     }
     if ($this->expires < time() and $this->_loaded) {
         // This object has expired
         $this->delete();
     }
 }
Esempio n. 18
0
 /**
  * Handles garbage collection and deleting of expired objects.
  *
  * @return  void
  */
 public function __construct($id = NULL)
 {
     parent::__construct($id);
     // Set the now, we use this a lot
     $this->_now = time();
     if (mt_rand(1, 100) === 1) {
         // Do garbage collection
         $this->delete_expired();
     }
     if ($this->expires < $this->_now) {
         // This object has expired
         $this->delete();
     }
 }
Esempio n. 19
0
 public function __construct($id = NULL)
 {
     $this->translator = FrontHelper::getTranslation();
     parent::__construct($id);
 }
Esempio n. 20
0
 public function __construct($id = FALSE)
 {
     parent::__construct($id);
 }
Esempio n. 21
0
 public function __construct($id = NULL)
 {
     $this->formulario = $this->limpiar_formulario();
     $this->errores = $this->formulario;
     parent::__construct($id);
 }
Esempio n. 22
0
 public function __construct($id = NULL)
 {
     $this->columns = Kohana::config($this->config_name . '.columns');
     $this->user_model = Kohana::config($this->config_name . '.user_model');
     parent::__construct($id);
 }
Esempio n. 23
0
 public function __construct($id = NULL, $db = false)
 {
     // set the config - call the parent.
     $this->config = Kohana::config($this->config_name);
     parent::__construct($id);
 }
 public function __construct($id = null)
 {
     parent::__construct($id);
     $this->foreign_key['page'] = 'page_pid';
 }
Esempio n. 25
0
 /**
  * Constructor
  *
  * @access public
  * @param integer $id 
  */
 public function __construct($id = NULL)
 {
     // Prepare the directory var...
     $this->directory = $this->directory === '' ? '' : trim($this->directory, '/') . '/';
     parent::__construct($id);
 }
Esempio n. 26
0
 public function __construct($connection = 'default')
 {
     parent::__construct('roles', $connection);
 }
Esempio n. 27
0
 function __construct($id = null)
 {
     parent::__construct($id);
     $this->model_name = inflector::singular($this->table_name);
 }
Esempio n. 28
0
 function __construct($id = null)
 {
     parent::__construct($id);
 }
Esempio n. 29
0
 function __construct($id = NULL)
 {
     parent::__construct($id);
 }
Esempio n. 30
0
 public function __construct($id = NULL)
 {
     $this->_columns = Kohana::config($this->_config)->columns;
     $this->_user_model = Kohana::config($this->_config)->user_model;
     parent::__construct($id);
 }