Skip to content

Commit

Permalink
3.1.1
Browse files Browse the repository at this point in the history
Date and TimeTZ
  • Loading branch information
Nurlan Mukhanov committed Aug 26, 2024
1 parent ab407e4 commit 99ec8e4
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "falseclock/dbd-php-entity",
"type": "library",
"version": "3.1.0",
"version": "3.1.1",
"description": "DTO like library to fetch any data in an Object-Oriented manner (ORM)",
"keywords": [
"dbd",
Expand Down
53 changes: 53 additions & 0 deletions src/DBD/Entity/Columns/DateColumn.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/********************************************************************************
* Apache License, Version 2.0 *
* *
* Copyright [2024] [Nurlan Mukhanov <[email protected]>] *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
********************************************************************************/

declare(strict_types=1);

namespace DBD\Entity\Columns;

use Attribute;
use DBD\Entity\Column;
use DBD\Entity\Primitives\TimePrimitives;

/**
* Class DateColumn
*
* @package DBD\Entity\Columns
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
class DateColumn extends Column
{
public function __construct(
string $name,
bool $nullable = false,
?string $defaultValue = null,
?string $annotation = null
)
{
parent::__construct([
Column::NAME => $name,
Column::PRIMITIVE_TYPE => TimePrimitives::Date,
Column::ORIGIN_TYPE => 'date',
Column::NULLABLE => $nullable,
Column::DEFAULT => $defaultValue,
Column::ANNOTATION => $annotation
]);
}
}
53 changes: 53 additions & 0 deletions src/DBD/Entity/Columns/TimeColumnTZ.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/********************************************************************************
* Apache License, Version 2.0 *
* *
* Copyright [2024] [Nurlan Mukhanov <[email protected]>] *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
********************************************************************************/

declare(strict_types=1);

namespace DBD\Entity\Columns;

use Attribute;
use DBD\Entity\Column;
use DBD\Entity\Primitives\TimePrimitives;

/**
* Class TimeColumnTZ
*
* @package DBD\Entity\Columns
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
class TimeColumnTZ extends Column
{
public function __construct(
string $name,
bool $nullable = false,
?string $defaultValue = null,
?string $annotation = null
)
{
parent::__construct([
Column::NAME => $name,
Column::PRIMITIVE_TYPE => TimePrimitives::TimeOfDay,
Column::ORIGIN_TYPE => 'timetz',
Column::NULLABLE => $nullable,
Column::DEFAULT => $defaultValue,
Column::ANNOTATION => $annotation
]);
}
}

0 comments on commit 99ec8e4

Please sign in to comment.