This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from repli2dev/nextras-orm
Implement read and create benchmark in Nextras ORM
- Loading branch information
Showing
14 changed files
with
617 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
return [ | ||
'driver' => 'mysqli', | ||
'host' => '127.0.0.1', | ||
'database' => 'orm_benchmark', | ||
'username' => 'enigma', | ||
'password' => 'secret', | ||
]; |
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,9 @@ | ||
<?php | ||
|
||
return [ | ||
'driver' => 'mysqli', | ||
'host' => 'mysql', | ||
'database' => 'orm_benchmark', | ||
'username' => 'enigma', | ||
'password' => 'secret', | ||
]; |
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,17 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Entity\Entity; | ||
|
||
/** | ||
* @property int $id {primary} | ||
* @property string $title | ||
* @property string $body | ||
* @property int $createdAt | ||
* @property int $updatedAt | ||
* @property Post $post {m:1 Post::$comments} | ||
*/ | ||
class Comment extends Entity | ||
{ | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Mapper\Mapper; | ||
|
||
class CommentsMapper extends Mapper | ||
{ | ||
public function getTableName(): string | ||
{ | ||
return 'comments'; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Repository\Repository; | ||
|
||
class CommentsRepository extends Repository | ||
{ | ||
|
||
/** | ||
* Returns possible entity class names for current repository. | ||
* @return string[] | ||
*/ | ||
public static function getEntityClassNames(): array | ||
{ | ||
return [Comment::class]; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Entity\Entity; | ||
use Nextras\Orm\Relationships\OneHasMany; | ||
|
||
/** | ||
* @property int $id {primary} | ||
* @property string $title | ||
* @property string $body | ||
* @property int $createdAt | ||
* @property int $updatedAt | ||
* @property OneHasMany|Comment[] $comments {1:m Comment::$post} | ||
*/ | ||
class Post extends Entity | ||
{ | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Mapper\Mapper; | ||
|
||
class PostsMapper extends Mapper | ||
{ | ||
public function getTableName(): string | ||
{ | ||
return 'posts'; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace OrmBench\NextrasOrm\Models; | ||
|
||
use Nextras\Orm\Repository\Repository; | ||
|
||
class PostsRepository extends Repository | ||
{ | ||
|
||
/** | ||
* Returns possible entity class names for current repository. | ||
* @return string[] | ||
*/ | ||
public static function getEntityClassNames(): array | ||
{ | ||
return [Post::class]; | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"require": { | ||
"php": ">=7.0.0", | ||
"nextras/orm": "3.0.0-rc2" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"OrmBench\\NextrasOrm\\": "./" | ||
} | ||
} | ||
} |
Oops, something went wrong.