當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBField::__construct方法代碼示例

本文整理匯總了PHP中DBField::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBField::__construct方法的具體用法?PHP DBField::__construct怎麽用?PHP DBField::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBField的用法示例。


在下文中一共展示了DBField::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Create a new Decimal field.
  *
  * @param string $name
  * @param int $wholeSize
  * @param int $decimalSize
  * @param float $defaultValue
  */
 public function __construct($name = null, $wholeSize = 9, $decimalSize = 2, $defaultValue = 0)
 {
     $this->wholeSize = is_int($wholeSize) ? $wholeSize : 9;
     $this->decimalSize = is_int($decimalSize) ? $decimalSize : 2;
     $this->defaultValue = number_format((double) $defaultValue, $decimalSize);
     parent::__construct($name);
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:15,代碼來源:Decimal.php

示例2: isset

 /**
  * Create a new Decimal field.
  */
 function __construct($name, $wholeSize = 9, $decimalSize = 2, $defaultValue = 0)
 {
     $this->wholeSize = isset($wholeSize) ? $wholeSize : 9;
     $this->decimalSize = isset($decimalSize) ? $decimalSize : 2;
     $this->defaultValue = $defaultValue;
     parent::__construct($name);
 }
開發者ID:comperio,項目名稱:silverstripe-framework,代碼行數:10,代碼來源:Decimal.php

示例3: array

 /**
  * Construct a string type field with a set of optional parameters
  * @param $name string The name of the field
  * @param $options array An array of options e.g. array('nullifyEmpty'=>false).  See {@link StringField::setOptions()} for information on the available options
  */
 function __construct($name = null, $options = array())
 {
     // Workaround: The singleton pattern calls this constructor with true/1 as the second parameter, so we must ignore it
     if (is_array($options)) {
         $this->setOptions($options);
     }
     parent::__construct($name);
 }
開發者ID:comperio,項目名稱:silverstripe-framework,代碼行數:13,代碼來源:StringField.php

示例4: __construct

 /**
  * Construct a string type field with a set of optional parameters.
  *
  * @param string $name string The name of the field
  * @param array $options array An array of options e.g. array('nullifyEmpty'=>false).  See
  *                       {@link StringField::setOptions()} for information on the available options
  */
 public function __construct($name = null, $options = array())
 {
     if ($options) {
         if (!is_array($options)) {
             throw new \InvalidArgumentException("Invalid options {$options}");
         }
         $this->setOptions($options);
     }
     parent::__construct($name);
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:17,代碼來源:DBString.php

示例5: __construct

 /**
  * Construct a string type field with a set of optional parameters
  * @param $name string The name of the field
  * @param $options array An array of options e.g. array('nullifyEmpty'=>false).  See {@link StringField::setOptions()} for information on the available options
  */
 public function __construct($name = null, $store = null)
 {
     if ($store && class_exists($store . 'ContentReader')) {
         $this->store = $store;
     } else {
         if ($store) {
             throw new Exception("{$store} does not exist; cannot use FileContent field with this type");
         }
     }
     parent::__construct($name);
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-content-services,代碼行數:16,代碼來源:FileContent.php

示例6: split

 /**
  * Create a new Enum field.
  * You should create an enum field like this: 
  *      		"MyField" => "Enum('Val1, Val2, Val3', 'Val1')"
  *	or: 		"MyField" => "Enum(Array('Val1', 'Val2', 'Val3'), 'Val1')"
  *  but NOT: 	"MyField" => "Enum('Val1', 'Val2', 'Val3', 'Val1')"
  * @param enum: A string containing a comma separated list of options or an array of Vals.
  * @param default The default option, which is either NULL or one of the items in the enumeration.
  */
 function __construct($name, $enum = NULL, $default = NULL)
 {
     if ($enum) {
         if (!is_array($enum)) {
             $enum = split(" *, *", trim($enum));
         }
         $this->enum = $enum;
         // If there's a default, then
         if ($default) {
             if (in_array($default, $enum)) {
                 $this->default = $default;
             } else {
                 user_error("Enum::__construct() The default value does not match any item in the enumeration", E_USER_ERROR);
             }
             // By default, set the default value to the first item
         } else {
             $this->default = reset($enum);
         }
     }
     parent::__construct($name);
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:30,代碼來源:Enum.php

示例7: __construct

 public function __construct($name = null)
 {
     $this->currencyLib = new Zend_Currency(null, i18n::get_locale());
     parent::__construct($name);
 }
開發者ID:jbrown40,項目名稱:nvweb,代碼行數:5,代碼來源:Money.php

示例8: __construct

 public function __construct($name = null, $defaultVal = 0)
 {
     $this->defaultVal = $defaultVal ? 1 : 0;
     parent::__construct($name);
 }
開發者ID:ivoba,項目名稱:silverstripe-framework,代碼行數:5,代碼來源:Boolean.php

示例9: __construct

 /**
  * DBField contrustor
  * 
  * @param string $name Field name
  */
 public function __construct($name = null)
 {
     $this->defaultVal = '000000100';
     parent::__construct($name);
 }
開發者ID:helpfulrobot,項目名稱:colymba-silverstripe-colorfield,代碼行數:10,代碼來源:Color.php

示例10: __construct

 public function __construct($name = null, $defaultVal = 0)
 {
     $this->defaultVal = is_float($defaultVal) ? $defaultVal : (double) 0;
     parent::__construct($name);
 }
開發者ID:jakedaleweb,項目名稱:AtomCodeChallenge,代碼行數:5,代碼來源:Float.php

示例11:

 function __construct($name = null, $srid = null)
 {
     $this->srid = $srid;
     parent::__construct($name);
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-solr,代碼行數:5,代碼來源:SolrGeoDBField.php

示例12: __construct

 public function __construct($name = null)
 {
     parent::__construct($name);
 }
開發者ID:jakedaleweb,項目名稱:link-field,代碼行數:4,代碼來源:WTLink.php

示例13: isset

 /**
  * Create a new Decimal field.
  */
 function __construct($name, $wholeSize = 9, $decimalSize = 2)
 {
     $this->wholeSize = isset($wholeSize) ? $wholeSize : 9;
     $this->decimalSize = isset($decimalSize) ? $decimalSize : 2;
     parent::__construct($name);
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:9,代碼來源:Decimal.php

示例14:

	function __construct($name, $defaultVal = 0) {
		$this->defaultVal = is_float($defaultVal) ? $defaultVal : (float) 0;
		
		parent::__construct($name);
	}
開發者ID:redema,項目名稱:sapphire,代碼行數:5,代碼來源:Float.php

示例15:

 function __construct($name, $size = 50)
 {
     $this->size = $size ? $size : 50;
     parent::__construct($name);
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:5,代碼來源:Varchar.php


注:本文中的DBField::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。