Skip to content

Commit d0f0472

Browse files
authored
V1.8 (#348)
* updated dependencies and basic php version * first green tests * greenbarred AddDropLabelsTest * greenbarred BeongsToManyRelationTest * greenbarred BelongsToRelationTest * greenbarred HasMnayRelationTest * greenbarred HasOneRelationTest * greenbarred ModelEventsTest * greenbarred OrdersAndLimitsTest * greenbarred ParameterGroupingTest * greenbarred PolymorphicHyperMorphToTest * greenbarred QueryingRelationsTest * greenbarred QueryScopesTest * greenbarred SimpleCRUDTest * greenbarred WheresTheTest * greenbarred all function tests * greenbarred ConnectionTest * greenbarred ConnectionFactoryTest * greenbarred BuilderTest * greenbarred GrammarTest * greenbarred ModelTest * greenbarred EloquentBuilderTest * greenbarred all tests * switched to alpine * updated client dependency * reworked authentication to not have to encode it * some code cleaning * Corrected autoloading tests * upgraded build steps to include all source files and composer installation * moved tests to dev autoload and removed vcs project * intial working version * fixed dispatch bug
1 parent 4202cbc commit d0f0472

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

composer.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
],
2222
"require": {
2323
"php": ">=7.4",
24-
"illuminate/container": "~5.3.0 || ~5.4.0 || ~5.5.0",
25-
"illuminate/contracts": "~5.3.0 || ~5.4.0 || ~5.5.0",
26-
"illuminate/database": "~5.3.0 || ~5.4.0 || ~5.5.0",
27-
"illuminate/events": "~5.3.0 || ~5.4.0 || ~5.5.0",
28-
"illuminate/support": "~5.3.0 || ~5.4.0 || ~5.5.0",
29-
"illuminate/pagination": "~5.3.0 || ~5.4.0 || ~5.5.0",
30-
"nesbot/carbon": "^1.0.0",
31-
"laudis/neo4j-php-client": "2.1.2"
24+
"illuminate/container": "^8.0",
25+
"illuminate/contracts": "^8.0",
26+
"illuminate/database": "^8.0",
27+
"illuminate/events": "^8.0",
28+
"illuminate/support": "^8.0",
29+
"illuminate/pagination": "^8.0",
30+
"nesbot/carbon": "^2.0",
31+
"laudis/neo4j-php-client": "^2.2"
3232
},
3333
"require-dev": {
3434
"mockery/mockery": "~1.3.0",
@@ -48,9 +48,6 @@
4848
}
4949
},
5050
"minimum-stability": "stable",
51-
"suggest": {
52-
"vinelab/neoeloquent: 1.5-dev": "Added support for Laravel 5.4. NeoEloquentServiceProvider52 was deprecated please use NeoEloquentServiceProvider"
53-
},
5451
"extra": {
5552
"laravel": {
5653
"providers": [

src/Eloquent/Model.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Vinelab\NeoEloquent\Eloquent;
44

5+
use BadMethodCallException;
56
use DateTime;
67
use Exception;
78
use ArrayAccess;
@@ -1205,7 +1206,7 @@ public function morphTo($name = null, $type = null, $id = null)
12051206
if (is_null($name)) {
12061207
list(, $caller) = debug_backtrace(false);
12071208

1208-
$name = snake_case($caller['function']);
1209+
$name = Str::snake($caller['function']);
12091210
}
12101211

12111212
list($type, $id) = $this->getMorphs($name, $type, $id);
@@ -1814,7 +1815,7 @@ protected function fireModelEvent($event, $halt = true)
18141815
// event set individually instead of catching event for all the models.
18151816
$event = "eloquent.{$event}: ".get_class($this);
18161817

1817-
$method = $halt ? 'until' : 'fire';
1818+
$method = $halt ? 'until' : 'dispatch';
18181819

18191820
return static::$dispatcher->$method($event, $this);
18201821
}
@@ -3728,9 +3729,18 @@ public function getQueueableConnection()
37283729
* @param mixed $value
37293730
* @return \Illuminate\Database\Eloquent\Model|null
37303731
*/
3731-
public function resolveRouteBinding($value)
3732+
public function resolveRouteBinding($value, $field=null)
37323733
{
37333734
return $this->where($this->getRouteKeyName(), $value)->first();
37343735
}
37353736

3737+
public function getQueueableRelations()
3738+
{
3739+
throw new BadMethodCallException('NeoEloquent does not support queueable relations yet');
3740+
}
3741+
3742+
public function resolveChildRouteBinding($childType, $value, $field)
3743+
{
3744+
throw new BadMethodCallException('NeoEloquent does not support queueable relations yet');
3745+
}
37363746
}

src/Eloquent/Relations/HasOneOrMany.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Vinelab\NeoEloquent\Eloquent\Relations;
44

5+
use Illuminate\Support\Str;
56
use Vinelab\NeoEloquent\Eloquent\Builder;
67
use Vinelab\NeoEloquent\Eloquent\Collection;
78
use Vinelab\NeoEloquent\Eloquent\Edges\Edge;
@@ -783,7 +784,7 @@ protected function touchingParent()
783784
*/
784785
protected function guessInverseRelation()
785786
{
786-
return camel_case(str_plural(class_basename($this->getParent())));
787+
return Str::camel(Str::plural(class_basename($this->getParent())));
787788
}
788789

789790
/**

tests/functional/ModelEventsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static function boot()
135135
call_user_func(static::$listenerStub[$event], $model);
136136
}
137137
});
138-
$dispatcher->shouldReceive('fire')->andReturnUsing(function ($event, $model) {
138+
$dispatcher->shouldReceive('dispatch')->andReturnUsing(function ($event, $model) {
139139
if (isset(static::$listenerStub[$event])) {
140140
call_user_func(static::$listenerStub[$event], $model);
141141
}
@@ -221,7 +221,7 @@ public static function boot()
221221
call_user_func(static::$listenerStub[$event], $model);
222222
}
223223
});
224-
$dispatcher->shouldReceive('fire')->andReturnUsing(function ($event, $model) {
224+
$dispatcher->shouldReceive('dispatch')->andReturnUsing(function ($event, $model) {
225225
if (isset(static::$listenerStub[$event])) {
226226
call_user_func(static::$listenerStub[$event], $model);
227227
}
@@ -305,7 +305,7 @@ public static function boot()
305305
call_user_func(static::$listenerStub[$event], $model);
306306
}
307307
});
308-
$dispatcher->shouldReceive('fire')->andReturnUsing(function ($event, $model) {
308+
$dispatcher->shouldReceive('dispatch')->andReturnUsing(function ($event, $model) {
309309
if (isset(static::$listenerStub[$event]) and strpos(static::$listenerStub[$event], '@') !== false) {
310310
list($listener, $method) = explode('@', static::$listenerStub[$event]);
311311
if (isset(static::$listenerStub[$event])) {

0 commit comments

Comments
 (0)