Skip to content

Commit

Permalink
Revert "Merge latest (#4)"
Browse files Browse the repository at this point in the history
This reverts commit 2e5d6b9.

# Conflicts:
#	src/Jenssegers/Mongodb/Eloquent/Model.php
  • Loading branch information
ScottSpittle committed Oct 29, 2019
1 parent 7fabc8c commit d6116eb
Show file tree
Hide file tree
Showing 68 changed files with 954 additions and 1,378 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ composer.lock
*.sublime-workspace
*.project
.idea/
.phpunit.result.cache
27 changes: 10 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
language: minimal

matrix:
include:
- name: "7.1"
env: PHP_VERSION=7.1
- name: "7.2"
env: PHP_VERSION=7.2
- name: "7.3"
env: PHP_VERSION=7.3
sudo: required
dist: trusty
language: php
php:
- "7.2"
- "7.1"

services:
- docker

cache:
directories:
- $HOME/.composer/cache

install:
- docker version
- sudo pip install docker-compose
- docker-compose version
- docker-compose build --build-arg PHP_VERSION=${PHP_VERSION}
- docker-compose run --rm tests composer install --no-interaction
- sed -i -e "s/php:cli/php:${TRAVIS_PHP_VERSION}-cli/g" Dockerfile
- cat Dockerfile
- docker-compose build

script:
- docker-compose run --rm tests ./vendor/bin/phpunit --coverage-clover ./clover.xml
- docker-compose up --exit-code-from php
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:cli

RUN pecl install xdebug

RUN apt-get update && \
apt-get install -y autoconf pkg-config libssl-dev git && \
pecl install mongodb git zlib1g-dev && docker-php-ext-enable mongodb && \
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug

RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer

ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ composer require jenssegers/mongodb
5.4.x | 3.2.x
5.5.x | 3.3.x
5.6.x | 3.4.x
5.7.x | 3.4.x
5.8.x | 3.5.x

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

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

```php
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name)
$capsule->getDatabaseManager()->extend('mongodb', function($config)
{
$config['name'] = $name;

return new Jenssegers\Mongodb\Connection($config);
});
```
Expand Down Expand Up @@ -302,7 +298,7 @@ This service provider will slightly modify the internal DatabaseReminderReposito

### Queues

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

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

```php
$count = User::increment('age');
$count = User->increment('age');
```

You may also specify additional columns to update:
Expand Down Expand Up @@ -549,13 +545,13 @@ User::where('name', 'regex', new \MongoDB\BSON\Regex("/.*doe/i"))->get();
**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.

```php
User::where('name', 'regexp', '/.*doe/i')->get();
User::where('name', 'regexp', '/.*doe/i'))->get();
```

And the inverse:

```php
User::where('name', 'not regexp', '/.*doe/i')->get();
User::where('name', 'not regexp', '/.*doe/i'))->get();
```

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

### Dates

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
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

Example:

Expand Down Expand Up @@ -810,7 +806,7 @@ class User extends Eloquent {
}
```

You can access the embedded models through the dynamic property:
You access the embedded models through the dynamic property:

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

### EmbedsOne Relations

The embedsOne relation is similar to the embedsMany relation, but only embeds a single model.
The embedsOne relation is similar to the EmbedsMany relation, but only embeds a single model.

```php
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
Expand All @@ -887,7 +883,7 @@ class Book extends Eloquent {
}
```

You can access the embedded models through the dynamic property:
You access the embedded models through the dynamic property:

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

**Push**

Add items to an array.
Add an items to an array.

```php
DB::collection('users')->where('name', 'John')->push('items', 'boots');
Expand Down
110 changes: 51 additions & 59 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,51 @@
{
"name": "jenssegers/mongodb",
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
"keywords": [
"laravel",
"eloquent",
"mongodb",
"mongo",
"database",
"model",
"moloquent"
],
"homepage": "https://github.com/jenssegers/laravel-mongodb",
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"license": "MIT",
"require": {
"illuminate/support": "^5.8|^6.0",
"illuminate/container": "^5.8|^6.0",
"illuminate/database": "^5.8|^6.0",
"illuminate/events": "^5.8|^6.0",
"mongodb/mongodb": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^7.0|^8.0",
"orchestra/testbench": "^3.1|^4.0",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
"doctrine/dbal": "^2.5"
},
"autoload": {
"psr-0": {
"Jenssegers\\Mongodb": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/models",
"tests/seeds"
]
},
"suggest": {
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
},
"extra": {
"laravel": {
"providers": [
"Jenssegers\\Mongodb\\MongodbServiceProvider",
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
]
}
}
}
{
"name": "jenssegers/mongodb",
"description": "A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)",
"keywords": ["laravel","eloquent","mongodb","mongo","database","model","moloquent"],
"homepage": "https://github.com/jenssegers/laravel-mongodb",
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"license" : "MIT",
"require": {
"illuminate/support": "^5.6",
"illuminate/container": "^5.6",
"illuminate/database": "^5.6",
"illuminate/events": "^5.6",
"mongodb/mongodb": "^1.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^7.0",
"orchestra/testbench": "^3.1",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
"doctrine/dbal": "^2.5"
},
"autoload": {
"psr-0": {
"Jenssegers\\Mongodb": "src/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/models",
"tests/seeds"
]
},
"suggest": {
"jenssegers/mongodb-session": "Add MongoDB session support to Laravel-MongoDB",
"jenssegers/mongodb-sentry": "Add Sentry support to Laravel-MongoDB"
},
"extra": {
"laravel": {
"providers": [
"Jenssegers\\Mongodb\\MongodbServiceProvider",
"Jenssegers\\Mongodb\\MongodbQueueServiceProvider"
]
}
}
}
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
version: '3'

services:
tests:
container_name: tests

php:
container_name: php
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/code
working_dir: /code
command: bash -c "composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit"
depends_on:
- mongodb
- mysql
- mongodb

mysql:
container_name: mysql
image: mysql:5.7
image: mysql
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: unittest
Expand All @@ -26,7 +28,5 @@ services:
mongodb:
container_name: mongodb
image: mongo
ports:
- 27017:27017
logging:
driver: none
11 changes: 11 additions & 0 deletions laravel-mongodb.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
38 changes: 17 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,42 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
>
<testsuites>
<testsuite name="all">
<directory>tests/</directory>
<exclude>tests/MysqlRelationsTest.php</exclude>
</testsuite>
<testsuite name="schema">
<file>tests/SchemaTest.php</file>
<directory>tests/SchemaTest.php</directory>
</testsuite>
<testsuite name="seeder">
<file>tests/SeederTest.php</file>
<directory>tests/SeederTest.php</directory>
</testsuite>
<testsuite name="cache">
<file>tests/CacheTest.php</file>
<directory>tests/CacheTest.php</directory>
</testsuite>
<testsuite name="builder">
<file>tests/QueryBuilderTest.php</file>
<file>tests/QueryTest.php</file>
<directory>tests/QueryBuilderTest.php</directory>
<directory>tests/QueryTest.php</directory>
</testsuite>
<testsuite name="model">
<file>tests/ModelTest.php</file>
<file>tests/RelationsTest.php</file>
<directory>tests/ModelTest.php</directory>
<directory>tests/RelationsTest.php</directory>
</testsuite>
<testsuite name="relations">
<file>tests/RelationsTest.php</file>
<file>tests/EmbeddedRelationsTest.php</file>
<directory>tests/RelationsTest.php</directory>
<directory>tests/EmbeddedRelationsTest.php</directory>
</testsuite>
<testsuite name="mysqlrelations">
<file>tests/RelationsTest.php</file>
<directory>tests/RelationsTest.php</directory>
<directory>tests/MysqlRelationsTest.php</directory>
</testsuite>
<testsuite name="validation">
<file>tests/ValidationTest.php</file>
<directory>tests/ValidationTest.php</directory>
</testsuite>
</testsuites>
<php>
<env name="MONGO_HOST" value="mongodb"/>
<env name="MONGO_DATABASE" value="unittest"/>
<env name="MONGO_PORT" value="27017"/>
<env name="MYSQL_HOST" value="mysql"/>
<env name="MYSQL_DATABASE" value="unittest"/>
<env name="MYSQL_USERNAME" value="root"/>
<env name="QUEUE_CONNECTION" value="database"/>
</php>
</phpunit>
Loading

0 comments on commit d6116eb

Please sign in to comment.