本文整理汇总了PHP中ORM::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::__construct方法的具体用法?PHP ORM::__construct怎么用?PHP ORM::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct($id = NULL)
{
parent::__construct($id);
// if($this->id!=true) {
// $this->where("web_type_id",1);
// }
}
示例2: __construct
public function __construct($data = [])
{
parent::__construct($data);
if ($this->createdAt) {
$this->createdAt = DateTime::createFromFormat('Y-m-d H:i:s', $this->createdAt);
}
}
示例3: __construct
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();
}
示例4: __construct
public function __construct($data)
{
parent::__construct();
if ($data && sizeof($data)) {
$this->populateFromRow($data);
}
}
示例5: __construct
/**
* 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);
}
示例6: __construct
/**
* 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();
}
示例7: __construct
public function __construct($id = NULL)
{
parent::__construct($id);
if (!$this->loaded()) {
$this->payment_date = time();
}
}
示例8: __construct
public function __construct($id = null)
{
parent::__construct($id);
if (!$this->loaded()) {
// Set reasonable defaults
$this->count = 0;
}
}
示例9: __construct
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'));
}
示例10: __construct
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;
}
}
示例11: load
/**
* 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;
}
示例12: __construct
/**
* 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);
}
示例13: __construct
/**
* 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);
}
示例14: __construct
/**
* 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);
}
示例15: __construct
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);
}
}