Skip to content

Port to Yii2 (Initial Commit). #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,17 @@ jobs:
strategy:
matrix:
php:
- 8.0
- 8.1
- 8.2
es:
- 8.1.3
- 7.14.0

services:
elasticsearch:
image: elasticsearch:${{ matrix.es }}
ports:
- 9200:9200
env:
http.publish_host: 127.0.0.1
transport.host: 127.0.0.1
xpack.security.enabled: false
indices.id_field_data.enabled: true
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
- 8.7.0

steps:
- name: Service elastisearch.
run: |
docker network create somenetwork
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -e "http.publish_host=127.0.0.1" -e "transport.host=127.0.0.1" -e "indices.id_field_data.enabled=true" -e "xpack.security.enabled=false" elasticsearch:${{ matrix.es }}

- name: Checkout.
uses: actions/checkout@v3

Expand All @@ -70,5 +57,15 @@ jobs:
- name: Install dependencies with composer.
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: Wait for Elasticsearch server to start.
run: wget --retry-connrefused --waitretry=3 --timeout=30 -t 10 -O /dev/null http://127.0.0.1:9200

- name: Run tests with phpunit.
run: vendor/bin/phpunit
run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always

- name: Upload coverage to Codecov.
if: matrix.php == '8.1'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
['8.1', '8.2']
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2']
['8.1', '8.2']
57 changes: 33 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
{
"name": "yiisoft/db-elasticsearch",
"description": "Yii Framework Elasticsearch Query and ActiveRecord",
"keywords": ["yii", "elasticsearch", "active-record", "search", "fulltext"],
"description": "Elasticsearch integration and ActiveRecord for the Yii framework",
"keywords": [
"yii2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"yii2",
"yii3",

"elasticsearch",
"active-record",
"search",
"fulltext"
],
"type": "library",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii-elasticsearch/issues",
"issues": "https://github.com/yiisoft/yii2-elasticsearch/issues",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be this package?

"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii-elasticsearch"
"source": "https://github.com/yiisoft/yii2-elasticsearch"
},
"authors": [
{
"name": "Carsten Brandt",
"email": "mail@cebe.cc"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"yiisoft/arrays": "^3.0@dev",
"yiisoft/di": "^3.0@dev",
"yiisoft/strings": "^3.0@dev",
"yiisoft/yii-core": "^3.0@dev",
"ext-curl": "*"
"php": "^8.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"paragonie/random_compat": ">=1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the compat library. randon is properly supported in new versions of PHP.

"psr/log": "^2.0|^3.0",
"yiisoft/arrays": "^3.0",
"yiisoft/json": "^1.0"
},
"require-dev": {
"yiisoft/log": "^3.0@dev",
"yiisoft/cache": "^3.0@dev",
"yiisoft/active-record": "^3.0@dev",
"phpunit/phpunit": "^9.0",
"hiqdev/composer-config-plugin": "^1.0@dev"
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.0",
"rector/rector": "^0.15",
"vimeo/psalm": "^4.8|^5.8"
},
"autoload": {
"psr-4": { "Yiisoft\\Db\\ElasticSearch\\": "src" }
"psr-4": {
"Yiisoft\\Elasticsearch\\": "src"
}
},
"autoload-dev": {
"psr-4": {"Yiisoft\\Db\\ElasticSearch\\Tests\\": "tests"}
"psr-4": {
"Yiisoft\\Elasticsearch\\Tests\\": "tests"
}
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for it.

}
},
"extra": {
"branch-alias": {
Expand Down
23 changes: 12 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="./tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<testsuites>
<testsuite name="Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd">
<coverage/>
<testsuites>
<testsuite name="Elasticsearch">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
161 changes: 0 additions & 161 deletions src/ActiveDataProvider.php

This file was deleted.

Loading