/** * Ensures convert_empty is not set on the field, as it prevents FALSE * from ever being set on the field. * * @param array $options */ public function __construct($options = array()) { parent::__construct($options); // Ensure convert_empty is FALSE if ($this->convert_empty) { throw new Kohana_Exception(':class cannot have convert_empty set to TRUE', array(':class' => get_class($this))); } }
/** * Ensures allow_null is not set to FALSE on the field, as it prevents * proper auto-incrementing of a primary key. * * @param array $options */ public function __construct($options = array()) { parent::__construct($options); // Ensure allow_null is TRUE if (!$this->allow_null) { throw new Kohana_Exception(':class cannot have allow_null set to FALSE', array(':class' => get_class($this))); } }
/** * Sets the default to 0 if we have no format, or an empty string otherwise. * * @param array $options */ public function __construct($options = array()) { parent::__construct($options); if (!isset($options['default']) and !$this->allow_null) { // Having a implies saving we're format a string, so we want a proper default $this->default = $this->format ? '' : 0; } if ($this->timezone === NULL) { $this->timezone = Jam_Timezone::instance(); } }