Skip to content

Commit d6116eb

Browse files
committed
Revert "Merge latest (#4)"
This reverts commit 2e5d6b9. # Conflicts: # src/Jenssegers/Mongodb/Eloquent/Model.php
1 parent 7fabc8c commit d6116eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+954
-1378
lines changed

.editorconfig

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ composer.lock
77
*.sublime-workspace
88
*.project
99
.idea/
10-
.phpunit.result.cache

.travis.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
language: minimal
2-
3-
matrix:
4-
include:
5-
- name: "7.1"
6-
env: PHP_VERSION=7.1
7-
- name: "7.2"
8-
env: PHP_VERSION=7.2
9-
- name: "7.3"
10-
env: PHP_VERSION=7.3
1+
sudo: required
2+
dist: trusty
3+
language: php
4+
php:
5+
- "7.2"
6+
- "7.1"
117

128
services:
139
- docker
1410

15-
cache:
16-
directories:
17-
- $HOME/.composer/cache
18-
1911
install:
2012
- docker version
2113
- sudo pip install docker-compose
2214
- docker-compose version
23-
- docker-compose build --build-arg PHP_VERSION=${PHP_VERSION}
24-
- docker-compose run --rm tests composer install --no-interaction
15+
- sed -i -e "s/php:cli/php:${TRAVIS_PHP_VERSION}-cli/g" Dockerfile
16+
- cat Dockerfile
17+
- docker-compose build
2518

2619
script:
27-
- docker-compose run --rm tests ./vendor/bin/phpunit --coverage-clover ./clover.xml
20+
- docker-compose up --exit-code-from php

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM php:cli
2+
3+
RUN pecl install xdebug
4+
5+
RUN apt-get update && \
6+
apt-get install -y autoconf pkg-config libssl-dev git && \
7+
pecl install mongodb git zlib1g-dev && docker-php-ext-enable mongodb && \
8+
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug
9+
10+
RUN curl -sS https://getcomposer.org/installer | php \
11+
&& mv composer.phar /usr/local/bin/ \
12+
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
13+
14+
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ composer require jenssegers/mongodb
4343
5.4.x | 3.2.x
4444
5.5.x | 3.3.x
4545
5.6.x | 3.4.x
46-
5.7.x | 3.4.x
47-
5.8.x | 3.5.x
4846

4947
And add the service provider in `config/app.php`:
5048

@@ -65,10 +63,8 @@ The service provider will register a mongodb database extension with the origina
6563
For usage outside Laravel, check out the [Capsule manager](https://github.com/illuminate/database/blob/master/README.md) and add:
6664

6765
```php
68-
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name)
66+
$capsule->getDatabaseManager()->extend('mongodb', function($config)
6967
{
70-
$config['name'] = $name;
71-
7268
return new Jenssegers\Mongodb\Connection($config);
7369
});
7470
```
@@ -302,7 +298,7 @@ This service provider will slightly modify the internal DatabaseReminderReposito
302298

303299
### Queues
304300

305-
If you want to use MongoDB as your database backend, change the driver in `config/queue.php`:
301+
If you want to use MongoDB as your database backend, change the the driver in `config/queue.php`:
306302

307303
```php
308304
'connections' => [
@@ -484,7 +480,7 @@ User::where('name', 'Jaques')->decrement('weight', 50);
484480
The number of updated objects is returned:
485481

486482
```php
487-
$count = User::increment('age');
483+
$count = User->increment('age');
488484
```
489485

490486
You may also specify additional columns to update:
@@ -549,13 +545,13 @@ User::where('name', 'regex', new \MongoDB\BSON\Regex("/.*doe/i"))->get();
549545
**NOTE:** you can also use the Laravel regexp operations. These are a bit more flexible and will automatically convert your regular expression string to a MongoDB\BSON\Regex object.
550546

551547
```php
552-
User::where('name', 'regexp', '/.*doe/i')->get();
548+
User::where('name', 'regexp', '/.*doe/i'))->get();
553549
```
554550

555551
And the inverse:
556552

557553
```php
558-
User::where('name', 'not regexp', '/.*doe/i')->get();
554+
User::where('name', 'not regexp', '/.*doe/i'))->get();
559555
```
560556

561557
**Type**
@@ -693,7 +689,7 @@ For more information about model manipulation, check http://laravel.com/docs/elo
693689

694690
### Dates
695691

696-
Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields, you will need to manually specify them as described here: http://laravel.com/docs/eloquent#date-mutators
692+
Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields you will need to manually specify them as described here: http://laravel.com/docs/eloquent#date-mutators
697693

698694
Example:
699695

@@ -810,7 +806,7 @@ class User extends Eloquent {
810806
}
811807
```
812808

813-
You can access the embedded models through the dynamic property:
809+
You access the embedded models through the dynamic property:
814810

815811
```php
816812
$books = User::first()->books;
@@ -872,7 +868,7 @@ Embedded relations will return a Collection of embedded items instead of a query
872868

873869
### EmbedsOne Relations
874870

875-
The embedsOne relation is similar to the embedsMany relation, but only embeds a single model.
871+
The embedsOne relation is similar to the EmbedsMany relation, but only embeds a single model.
876872

877873
```php
878874
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
@@ -887,7 +883,7 @@ class Book extends Eloquent {
887883
}
888884
```
889885

890-
You can access the embedded models through the dynamic property:
886+
You access the embedded models through the dynamic property:
891887

892888
```php
893889
$author = Book::first()->author;
@@ -1037,7 +1033,7 @@ DB::collection('items')->paginate($limit, $projections);
10371033

10381034
**Push**
10391035

1040-
Add items to an array.
1036+
Add an items to an array.
10411037

10421038
```php
10431039
DB::collection('users')->where('name', 'John')->push('items', 'boots');

composer.json

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,51 @@
1-
{
2-
"name": "jenssegers/mongodb",
3-
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
4-
"keywords": [
5-
"laravel",
6-
"eloquent",
7-
"mongodb",
8-
"mongo",
9-
"database",
10-
"model",
11-
"moloquent"
12-
],
13-
"homepage": "https://github.com/jenssegers/laravel-mongodb",
14-
"authors": [
15-
{
16-
"name": "Jens Segers",
17-
"homepage": "https://jenssegers.com"
18-
}
19-
],
20-
"license": "MIT",
21-
"require": {
22-
"illuminate/support": "^5.8|^6.0",
23-
"illuminate/container": "^5.8|^6.0",
24-
"illuminate/database": "^5.8|^6.0",
25-
"illuminate/events": "^5.8|^6.0",
26-
"mongodb/mongodb": "^1.4"
27-
},
28-
"require-dev": {
29-
"phpunit/phpunit": "^6.0|^7.0|^8.0",
30-
"orchestra/testbench": "^3.1|^4.0",
31-
"mockery/mockery": "^1.0",
32-
"satooshi/php-coveralls": "^2.0",
33-
"doctrine/dbal": "^2.5"
34-
},
35-
"autoload": {
36-
"psr-0": {
37-
"Jenssegers\\Mongodb": "src/"
38-
}
39-
},
40-
"autoload-dev": {
41-
"classmap": [
42-
"tests/TestCase.php",
43-
"tests/models",
44-
"tests/seeds"
45-
]
46-
},
47-
"suggest": {
48-
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
49-
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
50-
},
51-
"extra": {
52-
"laravel": {
53-
"providers": [
54-
"Jenssegers\\Mongodb\\MongodbServiceProvider",
55-
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
56-
]
57-
}
58-
}
59-
}
1+
{
2+
"name": "jenssegers/mongodb",
3+
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
4+
"keywords": ["laravel","eloquent","mongodb","mongo","database","model","moloquent"],
5+
"homepage": "https://github.com/jenssegers/laravel-mongodb",
6+
"authors": [
7+
{
8+
"name": "Jens Segers",
9+
"homepage": "https://jenssegers.com"
10+
}
11+
],
12+
"license" : "MIT",
13+
"require": {
14+
"illuminate/support": "^5.6",
15+
"illuminate/container": "^5.6",
16+
"illuminate/database": "^5.6",
17+
"illuminate/events": "^5.6",
18+
"mongodb/mongodb": "^1.0.0"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^6.0|^7.0",
22+
"orchestra/testbench": "^3.1",
23+
"mockery/mockery": "^1.0",
24+
"satooshi/php-coveralls": "^2.0",
25+
"doctrine/dbal": "^2.5"
26+
},
27+
"autoload": {
28+
"psr-0": {
29+
"Jenssegers\\Mongodb": "src/"
30+
}
31+
},
32+
"autoload-dev": {
33+
"classmap": [
34+
"tests/TestCase.php",
35+
"tests/models",
36+
"tests/seeds"
37+
]
38+
},
39+
"suggest": {
40+
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
41+
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
42+
},
43+
"extra": {
44+
"laravel": {
45+
"providers": [
46+
"Jenssegers\\Mongodb\\MongodbServiceProvider",
47+
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
48+
]
49+
}
50+
}
51+
}

docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
version: '3'
22

33
services:
4-
tests:
5-
container_name: tests
4+
5+
php:
6+
container_name: php
67
build:
78
context: .
89
dockerfile: Dockerfile
910
volumes:
1011
- .:/code
1112
working_dir: /code
13+
command: bash -c "composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit"
1214
depends_on:
13-
- mongodb
1415
- mysql
16+
- mongodb
1517

1618
mysql:
1719
container_name: mysql
18-
image: mysql:5.7
20+
image: mysql
1921
environment:
2022
MYSQL_ROOT_PASSWORD:
2123
MYSQL_DATABASE: unittest
@@ -26,7 +28,5 @@ services:
2628
mongodb:
2729
container_name: mongodb
2830
image: mongo
29-
ports:
30-
- 27017:27017
3131
logging:
3232
driver: none

laravel-mongodb.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="WEB_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

phpunit.xml.dist

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,42 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
processIsolation="false"
10-
stopOnFailure="false">
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
verbose="true"
13+
>
1114
<testsuites>
1215
<testsuite name="all">
1316
<directory>tests/</directory>
17+
<exclude>tests/MysqlRelationsTest.php</exclude>
1418
</testsuite>
1519
<testsuite name="schema">
16-
<file>tests/SchemaTest.php</file>
20+
<directory>tests/SchemaTest.php</directory>
1721
</testsuite>
1822
<testsuite name="seeder">
19-
<file>tests/SeederTest.php</file>
23+
<directory>tests/SeederTest.php</directory>
2024
</testsuite>
2125
<testsuite name="cache">
22-
<file>tests/CacheTest.php</file>
26+
<directory>tests/CacheTest.php</directory>
2327
</testsuite>
2428
<testsuite name="builder">
25-
<file>tests/QueryBuilderTest.php</file>
26-
<file>tests/QueryTest.php</file>
29+
<directory>tests/QueryBuilderTest.php</directory>
30+
<directory>tests/QueryTest.php</directory>
2731
</testsuite>
2832
<testsuite name="model">
29-
<file>tests/ModelTest.php</file>
30-
<file>tests/RelationsTest.php</file>
33+
<directory>tests/ModelTest.php</directory>
34+
<directory>tests/RelationsTest.php</directory>
3135
</testsuite>
3236
<testsuite name="relations">
33-
<file>tests/RelationsTest.php</file>
34-
<file>tests/EmbeddedRelationsTest.php</file>
37+
<directory>tests/RelationsTest.php</directory>
38+
<directory>tests/EmbeddedRelationsTest.php</directory>
3539
</testsuite>
3640
<testsuite name="mysqlrelations">
37-
<file>tests/RelationsTest.php</file>
41+
<directory>tests/RelationsTest.php</directory>
42+
<directory>tests/MysqlRelationsTest.php</directory>
3843
</testsuite>
3944
<testsuite name="validation">
40-
<file>tests/ValidationTest.php</file>
45+
<directory>tests/ValidationTest.php</directory>
4146
</testsuite>
4247
</testsuites>
43-
<php>
44-
<env name="MONGO_HOST" value="mongodb"/>
45-
<env name="MONGO_DATABASE" value="unittest"/>
46-
<env name="MONGO_PORT" value="27017"/>
47-
<env name="MYSQL_HOST" value="mysql"/>
48-
<env name="MYSQL_DATABASE" value="unittest"/>
49-
<env name="MYSQL_USERNAME" value="root"/>
50-
<env name="QUEUE_CONNECTION" value="database"/>
51-
</php>
5248
</phpunit>

0 commit comments

Comments
 (0)