Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
119 changed files
with
6,581 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@!eloquent | ||
Feature: Circular references handling | ||
In order to handle circular references | ||
As a developer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Core\Bridge\Eloquent; | ||
|
||
use Illuminate\Database\Eloquent\Builder as QueryBuilder; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Schema\Builder as SchemaBuilder; | ||
|
||
/** | ||
* Create a query or a schema builder from an Eloquent model. | ||
* | ||
* @experimental | ||
* | ||
* @author Alan Poulain <contact@alanpoulain.eu> | ||
*/ | ||
final class BuilderFactory implements BuilderFactoryInterface | ||
{ | ||
public function getQueryBuilder(string $modelClass): QueryBuilder | ||
{ | ||
return $modelClass::query(); | ||
} | ||
|
||
public function getSchemaBuilder(string $modelClass): SchemaBuilder | ||
{ | ||
/** @var Model $model */ | ||
$model = new $modelClass(); | ||
|
||
return $model->getConnection()->getSchemaBuilder(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Core\Bridge\Eloquent; | ||
|
||
use Illuminate\Database\Eloquent\Builder as QueryBuilder; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Schema\Builder as SchemaBuilder; | ||
|
||
/** | ||
* Create a query or a schema builder from an Eloquent model. | ||
* | ||
* @experimental | ||
* | ||
* @author Alan Poulain <contact@alanpoulain.eu> | ||
*/ | ||
interface BuilderFactoryInterface | ||
{ | ||
/** | ||
* @param class-string<Model> $modelClass | ||
*/ | ||
public function getQueryBuilder(string $modelClass): QueryBuilder; | ||
|
||
/** | ||
* @param class-string<Model> $modelClass | ||
*/ | ||
public function getSchemaBuilder(string $modelClass): SchemaBuilder; | ||
} |
Oops, something went wrong.