1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/AttributeFloat.php

65 lines
1.6 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model\Attribute;
class AttributeFloat extends Attribute
{
public function __construct()
{
parent::__construct();
$this
->addRule('min', [
2021-08-28 08:27:59 +12:00
'type' => self::TYPE_FLOAT,
'description' => 'Minimum value to enforce for new documents.',
'default' => null,
2021-08-28 08:27:59 +12:00
'example' => 1.5,
'array' => false,
'require' => false,
])
->addRule('max', [
2021-08-28 08:27:59 +12:00
'type' => self::TYPE_FLOAT,
'description' => 'Maximum value to enforce for new documents.',
'default' => null,
2021-08-28 08:27:59 +12:00
'example' => 10.5,
'array' => false,
2021-08-17 10:59:33 +12:00
'require' => false,
])
->addRule('default', [
'type' => self::TYPE_FLOAT,
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
'default' => null,
'example' => 2.5,
'array' => false,
2021-08-17 10:59:33 +12:00
'require' => false,
])
;
}
2021-09-14 20:26:16 +12:00
public array $conditions = [
'type' => self::TYPE_FLOAT,
];
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'AttributeFloat';
}
/**
2021-09-16 03:17:09 +12:00
* Get Type
*
* @return string
*/
public function getType():string
{
return Response::MODEL_ATTRIBUTE_FLOAT;
}
}