38 lines
780 B
PHP
Executable File
38 lines
780 B
PHP
Executable File
<?php
|
|
|
|
class ElementSalt extends ElementString {
|
|
|
|
private static $schema;
|
|
|
|
public static function getDefinition () {
|
|
|
|
if ( self::$schema )
|
|
return static::$schema;
|
|
|
|
return static::$schema= self::getSchema(array(
|
|
'format' => ElementString::getSchema(array('default' => 'Y-m-d', 'null' => 'false')),
|
|
'default' => ElementBoolean::getSchema(array('default' => false, 'null' => true)),
|
|
'null' => ElementBoolean::getSchema(array('default' => true, 'null' => true))
|
|
));
|
|
|
|
}
|
|
|
|
public static function getSchema ( $params = array() ) {
|
|
|
|
$params['type'] = 'date';
|
|
return $params;
|
|
|
|
}
|
|
|
|
public function apply ( $schema, $value, $data = array() ) {
|
|
|
|
if ( $value )
|
|
return parent::apply($schema, $value, $data);
|
|
|
|
return uniqid(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|