-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 兼容 pdo_pgsql float 值是 string 优化数组类型字段的类型注释 * 修复 pgsql 模型对字符串数组字段进行了不应该的长度验证
- Loading branch information
Showing
13 changed files
with
247 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Imi\Pgsql\Test\Model; | ||
|
||
use Imi\Bean\Annotation\Inherit; | ||
use Imi\Pgsql\Test\Model\Base\ArrayTestBase; | ||
|
||
/** | ||
* tb_array_test. | ||
* | ||
* @Inherit | ||
*/ | ||
class ArrayTest extends ArrayTestBase | ||
{ | ||
} |
130 changes: 130 additions & 0 deletions
130
src/Components/pgsql/tests/Model/Base/ArrayTestBase.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Imi\Pgsql\Test\Model\Base; | ||
|
||
use Imi\Config\Annotation\ConfigValue; | ||
use Imi\Model\Annotation\Column; | ||
use Imi\Model\Annotation\Entity; | ||
use Imi\Model\Annotation\Table; | ||
use Imi\Pgsql\Model\PgModel as Model; | ||
|
||
/** | ||
* tb_array_test 基类. | ||
* | ||
* @Entity(camel=true, bean=true, incrUpdate=false) | ||
* | ||
* @Table(name=@ConfigValue(name="@app.models.Imi\Pgsql\Test\Model\ArrayTest.name", default="tb_array_test"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Pgsql\Test\Model\ArrayTest.poolName")) | ||
* | ||
* @property int|null $id | ||
* @property array<int>|null $arr1 | ||
* @property array<array<string>>|null $arr2 | ||
*/ | ||
abstract class ArrayTestBase extends Model | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public const PRIMARY_KEY = 'id'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public const PRIMARY_KEYS = ['id']; | ||
|
||
/** | ||
* id. | ||
* | ||
* @Column(name="id", type="int4", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, ndims=0, virtual=false) | ||
*/ | ||
protected ?int $id = null; | ||
|
||
/** | ||
* 获取 id. | ||
*/ | ||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* 赋值 id. | ||
* | ||
* @param int|null $id id | ||
* | ||
* @return static | ||
*/ | ||
public function setId($id) | ||
{ | ||
$this->id = null === $id ? null : (int) $id; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* arr1. | ||
* | ||
* @Column(name="arr1", type="int8", length=-1, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=1, virtual=false) | ||
* | ||
* @var array<int>|null | ||
*/ | ||
protected ?array $arr1 = null; | ||
|
||
/** | ||
* 获取 arr1. | ||
* | ||
* @return array<int>|null | ||
*/ | ||
public function getArr1(): ?array | ||
{ | ||
return $this->arr1; | ||
} | ||
|
||
/** | ||
* 赋值 arr1. | ||
* | ||
* @param array<int>|null $arr1 arr1 | ||
* | ||
* @return static | ||
*/ | ||
public function setArr1($arr1) | ||
{ | ||
$this->arr1 = null === $arr1 ? null : $arr1; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* arr2. | ||
* | ||
* @Column(name="arr2", type="varchar", length=255, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, ndims=2, virtual=false) | ||
* | ||
* @var array<array<string>>|null | ||
*/ | ||
protected ?array $arr2 = null; | ||
|
||
/** | ||
* 获取 arr2. | ||
* | ||
* @return array<array<string>>|null | ||
*/ | ||
public function getArr2(): ?array | ||
{ | ||
return $this->arr2; | ||
} | ||
|
||
/** | ||
* 赋值 arr2. | ||
* | ||
* @param array<array<string>>|null $arr2 arr2 | ||
* | ||
* @return static | ||
*/ | ||
public function setArr2($arr2) | ||
{ | ||
$this->arr2 = null === $arr2 ? null : $arr2; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.