mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix missing use statements
BUG Fix incorrect method visibility on SS_Database BUG Fix obvious PHPDoc errors in SilverStripe\ORM\FieldType BUG Fix incorrect case on some method invocations API Remove some deprecated code
This commit is contained in:
parent
80d4af6b6e
commit
efef025027
@ -46,7 +46,7 @@ abstract class DBSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Injector injection point for database controller
|
* Injector injection point for database controller
|
||||||
*
|
*
|
||||||
* @param SS_Database $connector
|
* @param SS_Database $database
|
||||||
*/
|
*/
|
||||||
public function setDatabase(SS_Database $database) {
|
public function setDatabase(SS_Database $database) {
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
@ -127,6 +127,7 @@ abstract class DBSchemaManager {
|
|||||||
// Clear update list for client code to mess around with
|
// Clear update list for client code to mess around with
|
||||||
$this->schemaUpdateTransaction = array();
|
$this->schemaUpdateTransaction = array();
|
||||||
|
|
||||||
|
/** @var Exception $error */
|
||||||
$error = null;
|
$error = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -302,8 +303,8 @@ abstract class DBSchemaManager {
|
|||||||
* - array('fields' => array('A','B','C'), 'type' => 'index/unique/fulltext'): This gives you full
|
* - array('fields' => array('A','B','C'), 'type' => 'index/unique/fulltext'): This gives you full
|
||||||
* control over the index.
|
* control over the index.
|
||||||
* @param boolean $hasAutoIncPK A flag indicating that the primary key on this table is an autoincrement type
|
* @param boolean $hasAutoIncPK A flag indicating that the primary key on this table is an autoincrement type
|
||||||
* @param string $options SQL statement to append to the CREATE TABLE call.
|
* @param string|array $options SQL statement to append to the CREATE TABLE call.
|
||||||
* @param array $extensions List of extensions
|
* @param array|bool $extensions List of extensions
|
||||||
*/
|
*/
|
||||||
public function requireTable($table, $fieldSchema = null, $indexSchema = null, $hasAutoIncPK = true,
|
public function requireTable($table, $fieldSchema = null, $indexSchema = null, $hasAutoIncPK = true,
|
||||||
$options = array(), $extensions = false
|
$options = array(), $extensions = false
|
||||||
@ -539,6 +540,7 @@ abstract class DBSchemaManager {
|
|||||||
* @see parseIndexSpec() for approximate inverse
|
* @see parseIndexSpec() for approximate inverse
|
||||||
*
|
*
|
||||||
* @param string|array $indexSpec
|
* @param string|array $indexSpec
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function convertIndexSpec($indexSpec) {
|
protected function convertIndexSpec($indexSpec) {
|
||||||
// Return already converted spec
|
// Return already converted spec
|
||||||
@ -551,7 +553,7 @@ abstract class DBSchemaManager {
|
|||||||
/**
|
/**
|
||||||
* Returns true if the given table is exists in the current database
|
* Returns true if the given table is exists in the current database
|
||||||
*
|
*
|
||||||
* @param string $table Name of table to check
|
* @param string $tableName Name of table to check
|
||||||
* @return boolean Flag indicating existence of table
|
* @return boolean Flag indicating existence of table
|
||||||
*/
|
*/
|
||||||
abstract public function hasTable($tableName);
|
abstract public function hasTable($tableName);
|
||||||
@ -879,7 +881,7 @@ abstract class DBSchemaManager {
|
|||||||
* @param array $options An map of additional options. The available keys are as follows:
|
* @param array $options An map of additional options. The available keys are as follows:
|
||||||
* - 'MSSQLDatabase'/'MySQLDatabase'/'PostgreSQLDatabase' - database-specific options such as "engine" for MySQL.
|
* - 'MSSQLDatabase'/'MySQLDatabase'/'PostgreSQLDatabase' - database-specific options such as "engine" for MySQL.
|
||||||
* - 'temporary' - If true, then a temporary table will be created
|
* - 'temporary' - If true, then a temporary table will be created
|
||||||
* @param $advancedOptions Advanced creation options
|
* @param array $advancedOptions Advanced creation options
|
||||||
* @return string The table name generated. This may be different from the table name, for example with temporary
|
* @return string The table name generated. This may be different from the table name, for example with temporary
|
||||||
* tables.
|
* tables.
|
||||||
*/
|
*/
|
||||||
@ -940,8 +942,7 @@ abstract class DBSchemaManager {
|
|||||||
* This allows the cached values for a table's field list to be erased.
|
* This allows the cached values for a table's field list to be erased.
|
||||||
* If $tablename is empty, then the whole cache is erased.
|
* If $tablename is empty, then the whole cache is erased.
|
||||||
*
|
*
|
||||||
* @param string $tableName
|
* @param string|bool $tableName
|
||||||
*
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function clearCachedFieldlist($tableName = false) {
|
public function clearCachedFieldlist($tableName = false) {
|
||||||
|
@ -560,7 +560,7 @@ abstract class SS_Database {
|
|||||||
* @return boolean Flag indicating support for all of the above
|
* @return boolean Flag indicating support for all of the above
|
||||||
* @todo Write test cases
|
* @todo Write test cases
|
||||||
*/
|
*/
|
||||||
protected function supportsExtensions($extensions) {
|
public function supportsExtensions($extensions) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ use Config;
|
|||||||
use LogicException;
|
use LogicException;
|
||||||
use Cookie;
|
use Cookie;
|
||||||
use Injector;
|
use Injector;
|
||||||
|
use SilverStripe\ORM\Connect\DBSchemaManager;
|
||||||
use SilverStripe\ORM\Queries\SQLExpression;
|
use SilverStripe\ORM\Queries\SQLExpression;
|
||||||
use SilverStripe\ORM\Connect\SS_Database;
|
use SilverStripe\ORM\Connect\SS_Database;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\ORM\FieldType;
|
|||||||
use Object;
|
use Object;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Queries\SQLSelect;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +128,7 @@ abstract class DBComposite extends DBField {
|
|||||||
public function requireField() {
|
public function requireField() {
|
||||||
foreach($this->compositeDatabaseFields() as $field => $spec){
|
foreach($this->compositeDatabaseFields() as $field => $spec){
|
||||||
$key = $this->getName() . $field;
|
$key = $this->getName() . $field;
|
||||||
DB::requireField($this->tableName, $key, $spec);
|
DB::require_field($this->tableName, $key, $spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +240,8 @@ abstract class DBComposite extends DBField {
|
|||||||
// Set bound object
|
// Set bound object
|
||||||
if($this->record instanceof DataObject) {
|
if($this->record instanceof DataObject) {
|
||||||
$key = $this->getName() . $field;
|
$key = $this->getName() . $field;
|
||||||
return $this->record->setField($key, $value);
|
$this->record->setField($key, $value);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set local record
|
// Set local record
|
||||||
@ -272,8 +274,7 @@ abstract class DBComposite extends DBField {
|
|||||||
return $fields[$field];
|
return $fields[$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent::castingHelper($field);
|
||||||
parent::castingHelper($field);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
use Deprecation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a decimal field containing a currency amount.
|
* Represents a decimal field containing a currency amount.
|
||||||
* The currency class only supports single currencies. For multi-currency support, use {@link Money}
|
* The currency class only supports single currencies. For multi-currency support, use {@link Money}
|
||||||
@ -63,15 +61,5 @@ class DBCurrency extends DBDecimal {
|
|||||||
$this->value = 0;
|
$this->value = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated 4.0 Use the "Currency.currency_symbol" config setting instead
|
|
||||||
* @param [type] $value [description]
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static function setCurrencySymbol($value) {
|
|
||||||
Deprecation::notice('4.0', 'Use the "Currency.currency_symbol" config setting instead');
|
|
||||||
DBCurrency::config()->currency_symbol = $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class DBDate extends DBField {
|
|||||||
} elseif(is_string($value)) {
|
} elseif(is_string($value)) {
|
||||||
try{
|
try{
|
||||||
$date = new DateTime($value);
|
$date = new DateTime($value);
|
||||||
$this->value = $date->Format('Y-m-d');
|
$this->value = $date->format('Y-m-d');
|
||||||
return;
|
return;
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
$this->value = null;
|
$this->value = null;
|
||||||
@ -120,7 +120,7 @@ class DBDate extends DBField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the day of the month.
|
* Returns the day of the month.
|
||||||
* @param boolean $includeOrdinals Include ordinal suffix to day, e.g. "th" or "rd"
|
* @param bool $includeOrdinal Include ordinal suffix to day, e.g. "th" or "rd"
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function DayOfMonth($includeOrdinal = false) {
|
public function DayOfMonth($includeOrdinal = false) {
|
||||||
@ -154,7 +154,7 @@ class DBDate extends DBField {
|
|||||||
public function Format($format) {
|
public function Format($format) {
|
||||||
if($this->value){
|
if($this->value){
|
||||||
$date = new DateTime($this->value);
|
$date = new DateTime($this->value);
|
||||||
return $date->Format($format);
|
return $date->format($format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +163,9 @@ class DBDate extends DBField {
|
|||||||
*
|
*
|
||||||
* strftime obeys the current LC_TIME/LC_ALL when printing lexical values
|
* strftime obeys the current LC_TIME/LC_ALL when printing lexical values
|
||||||
* like day- and month-names
|
* like day- and month-names
|
||||||
|
*
|
||||||
|
* @param string $formattingString
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function FormatI18N($formattingString) {
|
public function FormatI18N($formattingString) {
|
||||||
if($this->value) {
|
if($this->value) {
|
||||||
@ -192,10 +195,11 @@ class DBDate extends DBField {
|
|||||||
return $zendDate->toString($formatD);
|
return $zendDate->toString($formatD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Return a string in the form "12 - 16 Sept" or "12 Aug - 16 Sept"
|
* Return a string in the form "12 - 16 Sept" or "12 Aug - 16 Sept"
|
||||||
* @param Date $otherDateObj Another date object specifying the end of the range
|
*
|
||||||
* @param boolean $includeOrdinals Include ordinal suffix to day, e.g. "th" or "rd"
|
* @param DBDate $otherDateObj Another date object specifying the end of the range
|
||||||
|
* @param bool $includeOrdinals Include ordinal suffix to day, e.g. "th" or "rd"
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function RangeString($otherDateObj, $includeOrdinals = false) {
|
public function RangeString($otherDateObj, $includeOrdinals = false) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
use Convert;
|
use Convert;
|
||||||
|
use Exception;
|
||||||
use Member;
|
use Member;
|
||||||
use DatetimeField;
|
use DatetimeField;
|
||||||
use Zend_Date;
|
use Zend_Date;
|
||||||
@ -59,12 +60,11 @@ class DBDatetime extends DBDate implements TemplateGlobalProvider {
|
|||||||
if(is_numeric($value)) {
|
if(is_numeric($value)) {
|
||||||
$this->value = date('Y-m-d H:i:s', $value);
|
$this->value = date('Y-m-d H:i:s', $value);
|
||||||
} elseif(is_string($value)) {
|
} elseif(is_string($value)) {
|
||||||
// $this->value = date('Y-m-d H:i:s', strtotime($value));
|
try {
|
||||||
try{
|
|
||||||
$date = new DateTime($value);
|
$date = new DateTime($value);
|
||||||
$this->value = $date->Format('Y-m-d H:i:s');
|
$this->value = $date->format('Y-m-d H:i:s');
|
||||||
return;
|
return;
|
||||||
}catch(Exception $e){
|
} catch(Exception $e) {
|
||||||
$this->value = null;
|
$this->value = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
use NumericField;
|
use NumericField;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +22,7 @@ class DBDecimal extends DBField {
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param int $wholeSize
|
* @param int $wholeSize
|
||||||
* @param int $decimalSize
|
* @param int $decimalSize
|
||||||
* @param float $defaultValue
|
* @param float|int $defaultValue
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $wholeSize = 9, $decimalSize = 2, $defaultValue = 0) {
|
public function __construct($name = null, $wholeSize = 9, $decimalSize = 2, $defaultValue = 0) {
|
||||||
$this->wholeSize = is_int($wholeSize) ? $wholeSize : 9;
|
$this->wholeSize = is_int($wholeSize) ? $wholeSize : 9;
|
||||||
|
@ -50,9 +50,10 @@ class DBEnum extends DBString {
|
|||||||
* "MyField" => "Enum(array('Val1', 'Val2', 'Val3'), 'Val1')"
|
* "MyField" => "Enum(array('Val1', 'Val2', 'Val3'), 'Val1')"
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param enum: A string containing a comma separated list of options or an
|
* @param string $name
|
||||||
|
* @param string|array $enum A string containing a comma separated list of options or an
|
||||||
* array of Vals.
|
* array of Vals.
|
||||||
* @param string The default option, which is either NULL or one of the
|
* @param string $default The default option, which is either NULL or one of the
|
||||||
* items in the enumeration.
|
* items in the enumeration.
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $enum = NULL, $default = NULL) {
|
public function __construct($name = null, $enum = NULL, $default = NULL) {
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
|
use FormField;
|
||||||
|
use SearchFilter;
|
||||||
|
use SilverStripe\ORM\Connect\SS_Query;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use ViewableData;
|
use ViewableData;
|
||||||
use Convert;
|
use Convert;
|
||||||
use Object;
|
use Object;
|
||||||
@ -151,7 +155,7 @@ abstract class DBField extends ViewableData {
|
|||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @param DataObject|array $record An array or object that this field is part of
|
* @param DataObject|array $record An array or object that this field is part of
|
||||||
* @param boolean $markChanged Indicate wether this field should be marked changed.
|
* @param bool $markChanged Indicate wether this field should be marked changed.
|
||||||
* Set to FALSE if you are initializing this field after construction, rather
|
* Set to FALSE if you are initializing this field after construction, rather
|
||||||
* than setting a new value.
|
* than setting a new value.
|
||||||
*/
|
*/
|
||||||
@ -348,6 +352,7 @@ abstract class DBField extends ViewableData {
|
|||||||
* search filters (note: parameter hack now in place to pass in the required full path - using $this->name
|
* search filters (note: parameter hack now in place to pass in the required full path - using $this->name
|
||||||
* won't work)
|
* won't work)
|
||||||
*
|
*
|
||||||
|
* @param string|bool $name
|
||||||
* @return SearchFilter
|
* @return SearchFilter
|
||||||
*/
|
*/
|
||||||
public function defaultSearchFilter($name = false) {
|
public function defaultSearchFilter($name = false) {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
|
use File;
|
||||||
|
use Image;
|
||||||
use UploadField;
|
use UploadField;
|
||||||
use DropdownField;
|
use DropdownField;
|
||||||
use NumericField;
|
use NumericField;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
|
use FormField;
|
||||||
use i18n;
|
use i18n;
|
||||||
use Zend_Currency;
|
use Zend_Currency;
|
||||||
use MoneyField;
|
use MoneyField;
|
||||||
@ -75,6 +76,7 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function NiceWithShortname($options = array()){
|
public function NiceWithShortname($options = array()){
|
||||||
@ -83,6 +85,7 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function NiceWithName($options = array()){
|
public function NiceWithName($options = array()){
|
||||||
@ -98,7 +101,8 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string $currency
|
||||||
|
* @param bool $markChanged
|
||||||
*/
|
*/
|
||||||
public function setCurrency($currency, $markChanged = true) {
|
public function setCurrency($currency, $markChanged = true) {
|
||||||
$this->setField('Currency', $currency, $markChanged);
|
$this->setField('Currency', $currency, $markChanged);
|
||||||
@ -113,6 +117,7 @@ class DBMoney extends DBComposite {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param float $amount
|
* @param float $amount
|
||||||
|
* @param bool $markChanged
|
||||||
*/
|
*/
|
||||||
public function setAmount($amount, $markChanged = true) {
|
public function setAmount($amount, $markChanged = true) {
|
||||||
$this->setField('Amount', (float)$amount, $markChanged);
|
$this->setField('Amount', (float)$amount, $markChanged);
|
||||||
@ -149,6 +154,8 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $currency
|
||||||
|
* @param string $locale
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSymbol($currency = null, $locale = null) {
|
public function getSymbol($currency = null, $locale = null) {
|
||||||
@ -160,6 +167,8 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $currency
|
||||||
|
* @param string $locale
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getShortName($currency = null, $locale = null) {
|
public function getShortName($currency = null, $locale = null) {
|
||||||
@ -170,6 +179,8 @@ class DBMoney extends DBComposite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $currency
|
||||||
|
* @param string $locale
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCurrencyName($currency = null, $locale = null) {
|
public function getCurrencyName($currency = null, $locale = null) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\ORM\FieldType;
|
namespace SilverStripe\ORM\FieldType;
|
||||||
|
|
||||||
use CheckboxSetField;
|
use CheckboxSetField;
|
||||||
|
use Config;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +32,7 @@ class DBMultiEnum extends DBEnum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function requireField(){
|
public function requireField(){
|
||||||
|
// @todo: Remove mysql-centric logic from this
|
||||||
$charset = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'charset');
|
$charset = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'charset');
|
||||||
$collation = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'collation');
|
$collation = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'collation');
|
||||||
$values=array(
|
$values=array(
|
||||||
|
@ -20,6 +20,9 @@ class DBPercentage extends DBDecimal {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Decimal field.
|
* Create a new Decimal field.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param int $precision
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $precision = 4) {
|
public function __construct($name = null, $precision = 4) {
|
||||||
if(!$precision) $precision = 4;
|
if(!$precision) $precision = 4;
|
||||||
|
@ -43,7 +43,7 @@ class DBPrimaryKey extends DBInt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param DataOject $object The object that this is primary key for (should have a relation with $name)
|
* @param DataObject $object The object that this is primary key for (should have a relation with $name)
|
||||||
*/
|
*/
|
||||||
public function __construct($name, $object = null) {
|
public function __construct($name, $object = null) {
|
||||||
$this->object = $object;
|
$this->object = $object;
|
||||||
|
@ -49,14 +49,13 @@ abstract class DBString extends DBField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the optional parameters for this field.
|
* Update the optional parameters for this field.
|
||||||
* @param $options array of options
|
* @param array $options array of options
|
||||||
* The options allowed are:
|
* The options allowed are:
|
||||||
* <ul><li>"nullifyEmpty"
|
* <ul><li>"nullifyEmpty"
|
||||||
* This is a boolean flag.
|
* This is a boolean flag.
|
||||||
* True (the default) means that empty strings are automatically converted to nulls to be stored in
|
* True (the default) means that empty strings are automatically converted to nulls to be stored in
|
||||||
* the database. Set it to false to ensure that nulls and empty strings are kept intact in the database.
|
* the database. Set it to false to ensure that nulls and empty strings are kept intact in the database.
|
||||||
* </li></ul>
|
* </li></ul>
|
||||||
* @return unknown_type
|
|
||||||
*/
|
*/
|
||||||
public function setOptions(array $options = array()) {
|
public function setOptions(array $options = array()) {
|
||||||
if(array_key_exists("nullifyEmpty", $options)) {
|
if(array_key_exists("nullifyEmpty", $options)) {
|
||||||
|
@ -63,7 +63,7 @@ class DBText extends DBString {
|
|||||||
'parts' => $parts
|
'parts' => $parts
|
||||||
);
|
);
|
||||||
|
|
||||||
DB::require_field($this->tableName, $this->name, $values, $this->default);
|
DB::require_field($this->tableName, $this->name, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +78,7 @@ class DBText extends DBString {
|
|||||||
* Limit sentences, can be controlled by passing an integer.
|
* Limit sentences, can be controlled by passing an integer.
|
||||||
*
|
*
|
||||||
* @param int $sentCount The amount of sentences you want.
|
* @param int $sentCount The amount of sentences you want.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function LimitSentences($sentCount = 2) {
|
public function LimitSentences($sentCount = 2) {
|
||||||
if(!is_numeric($sentCount)) {
|
if(!is_numeric($sentCount)) {
|
||||||
@ -209,7 +210,7 @@ class DBText extends DBString {
|
|||||||
// get first sentence?
|
// get first sentence?
|
||||||
// this needs to be more robust
|
// this needs to be more robust
|
||||||
if($plain && $plain != 'html') {
|
if($plain && $plain != 'html') {
|
||||||
$data = Convert::xml2raw($this->value, true);
|
$data = Convert::xml2raw($this->value);
|
||||||
if(!$data) return "";
|
if(!$data) return "";
|
||||||
|
|
||||||
// grab the first paragraph, or, failing that, the whole content
|
// grab the first paragraph, or, failing that, the whole content
|
||||||
@ -238,8 +239,8 @@ class DBText extends DBString {
|
|||||||
* @param boolean $string Supplied string ("keywords")
|
* @param boolean $string Supplied string ("keywords")
|
||||||
* @param boolean $striphtml Strip HTML?
|
* @param boolean $striphtml Strip HTML?
|
||||||
* @param boolean $highlight Add a highlight <span> element around search query?
|
* @param boolean $highlight Add a highlight <span> element around search query?
|
||||||
* @param String prefix text
|
* @param string $prefix text
|
||||||
* @param String suffix
|
* @param string $suffix
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -293,6 +294,7 @@ class DBText extends DBString {
|
|||||||
* Allows a sub-class of TextParser to be rendered.
|
* Allows a sub-class of TextParser to be rendered.
|
||||||
*
|
*
|
||||||
* @see TextParser for implementation details.
|
* @see TextParser for implementation details.
|
||||||
|
* @param string $parser
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Parse($parser = "TextParser") {
|
public function Parse($parser = "TextParser") {
|
||||||
|
@ -29,11 +29,10 @@ class DBVarchar extends DBString {
|
|||||||
/**
|
/**
|
||||||
* Construct a new short text field
|
* Construct a new short text field
|
||||||
*
|
*
|
||||||
* @param $name string The name of the field
|
* @param string $name The name of the field
|
||||||
* @param $size int The maximum size of the field, in terms of characters
|
* @param int $size The maximum size of the field, in terms of characters
|
||||||
* @param $options array Optional parameters, e.g. array("nullifyEmpty"=>false).
|
* @param array $options Optional parameters, e.g. array("nullifyEmpty"=>false).
|
||||||
* See {@link StringField::setOptions()} for information on the available options
|
* See {@link StringField::setOptions()} for information on the available options
|
||||||
* @return unknown_type
|
|
||||||
*/
|
*/
|
||||||
public function __construct($name = null, $size = 50, $options = array()) {
|
public function __construct($name = null, $size = 50, $options = array()) {
|
||||||
$this->size = $size ? $size : 50;
|
$this->size = $size ? $size : 50;
|
||||||
|
@ -36,8 +36,8 @@ class DBYear extends DBField {
|
|||||||
* input values. Starts by default at the current year,
|
* input values. Starts by default at the current year,
|
||||||
* and counts back to 1900.
|
* and counts back to 1900.
|
||||||
*
|
*
|
||||||
* @param int $start starting date to count down from
|
* @param int|bool $start starting date to count down from
|
||||||
* @param int $end end date to count down to
|
* @param int|bool $end end date to count down to
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getDefaultOptions($start=false, $end=false) {
|
private function getDefaultOptions($start=false, $end=false) {
|
||||||
|
Loading…
Reference in New Issue
Block a user