Skip to content

Commit b1b9c4a

Browse files
authored
Merge pull request #114: Add fields autocompletion for ORM::make
2 parents de65af5 + 479935d commit b1b9c4a

File tree

7 files changed

+34
-21
lines changed

7 files changed

+34
-21
lines changed

‎.github/workflows/main.yml‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ jobs:
77
name: Test PHP ${{ matrix.php-version }} with Code Coverage
88
runs-on: ubuntu-latest
99
strategy:
10-
fail-fast: false
1110
matrix:
1211
php-version: ['8.1', '8.2', '8.3', '8.4']
1312
steps:
13+
- name: Install ODBC driver.
14+
run: |
15+
sudo curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
16+
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
1417
- name: Checkout
1518
uses: actions/checkout@v2
1619
- name: Setup DB services
@@ -24,24 +27,13 @@ jobs:
2427
php-version: ${{ matrix.php-version }}
2528
coverage: pcov
2629
tools: pecl
27-
extensions: mbstring, pdo, pdo_sqlite, pdo_pgsql, pdo_sqlsrv-5.11, pdo_mysql
28-
- name: Get Composer Cache Directory
29-
id: composer-cache
30-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
31-
- name: Restore Composer Cache
32-
uses: actions/cache@v4
33-
with:
34-
path: ${{ steps.composer-cache.outputs.dir }}
35-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
36-
restore-keys: ${{ runner.os }}-composer-
30+
extensions: mbstring, pdo, pdo_sqlite, pdo_pgsql, pdo_sqlsrv, pdo_mysql
3731

38-
- name: Install dependencies with composer
39-
if: matrix.php-version != '8.4'
40-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
32+
- name: Validate composer.json and composer.lock
33+
run: composer validate --ansi --strict
4134

42-
- name: Install dependencies with composer php 8.4
43-
if: matrix.php-version == '8.4'
44-
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
35+
- name: Install dependencies with composer
36+
uses: ramsey/composer-install@v3
4537

4638
- name: Execute Tests
4739
run: |

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"require-dev": {
4848
"doctrine/annotations": "^1.14.3 || ^2.0.1",
4949
"phpunit/phpunit": "^10.1",
50-
"vimeo/psalm": "^5.26",
50+
"vimeo/psalm": "^5.26 || ^6.0",
5151
"spiral/code-style": "^2.2",
5252
"spiral/dumper": "^3.3"
5353
},

‎psalm-baseline.xml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@
121121
</InvalidClassConstantType>
122122
</file>
123123
<file src="src/Annotation/Relation/Relation.php">
124-
<MixedInferredReturnType>
125-
<code><![CDATA[non-empty-string]]></code>
126-
</MixedInferredReturnType>
127124
<MixedReturnStatement>
128125
<code><![CDATA[static::TYPE]]></code>
129126
</MixedReturnStatement>

‎psalm.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
</ignoreFiles>
1515
</projectFiles>
1616
<issueHandlers>
17+
<PossiblyUnusedMethod errorLevel="suppress"/>
18+
<ClassMustBeFinal errorLevel="suppress"/>
19+
<UnusedClass errorLevel="suppress"/>
20+
<MissingOverrideAttribute errorLevel="suppress"/>
1721
<MissingClassConstType errorLevel="suppress"/>
1822
<UndefinedAttributeClass>
1923
<errorLevel type="suppress">

‎resources/orm.meta-storm.xml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<meta-storm xmlns="meta-storm">
3+
<definitions>
4+
<!-- ORM Interface -->
5+
<classMethod class="\Cycle\ORM\Service\EntityFactoryInterface" method="make" argument="1" targetInArray="key" targetValue="false">
6+
<properties xpath="$argument[0]">
7+
<filters>
8+
<hasAttribute class="\Cycle\Annotated\Annotation\Column"/>
9+
</filters>
10+
</properties>
11+
</classMethod>
12+
</definitions>
13+
</meta-storm>

‎src/Annotation/GeneratedValue.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
use Spiral\Attributes\NamedArgumentConstructor;
99

1010
/**
11+
* Specifies that the field value is generated by the database or ORM.
12+
*
13+
* - before insert: the field is generated before the entity is inserted into the database on PHP side (e.g., UUIDs).
14+
* - on insert: the field is generated by the database on insert (e.g., auto-increment).
15+
* - before update: the field is generated before the entity is updated in the database on PHP side (e.g., `onUpdate`).
16+
*
1117
* @Annotation
1218
* @NamedArgumentConstructor
1319
* @Target({"PROPERTY"})

‎tests/bootstrap.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
database: 'tempdb',
4141
host: '127.0.0.1',
4242
port: 11433,
43+
trustServerCertificate: true,
4344
user: 'SA',
4445
password: 'YourStrong!Passw0rd',
4546
),

0 commit comments

Comments
 (0)