Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #26 from repli2dev/nextras-orm
Browse files Browse the repository at this point in the history
Implement read and create benchmark in Nextras ORM
  • Loading branch information
sergeyklay authored Feb 19, 2018
2 parents 649fd93 + 21ebb2c commit e318aec
Show file tree
Hide file tree
Showing 14 changed files with 617 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
- PROVIDER=phalcon HAS_CACHING_METADATA_SUPPORT=1 HAS_BATCHING_SUPPORT=0
- PROVIDER=propel HAS_CACHING_METADATA_SUPPORT=0 HAS_BATCHING_SUPPORT=0
- PROVIDER=yii HAS_CACHING_METADATA_SUPPORT=1 HAS_BATCHING_SUPPORT=1
- PROVIDER=nextrasorm HAS_CACHING_METADATA_SUPPORT=1 HAS_BATCHING_SUPPORT=1

matrix:
fast_finish: true
Expand Down Expand Up @@ -64,6 +65,7 @@ install:
- echo 'SHOW VARIABLES LIKE "%version%"' | mysql -u root

before_script:
- mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
- echo 'CREATE DATABASE orm_benchmark CHARSET=utf8 COLLATE=utf8_unicode_ci' | mysql -u root
- echo "CREATE USER 'enigma'@'%' IDENTIFIED BY 'secret'" | mysql -u root
- echo "GRANT ALL PRIVILEGES ON orm_benchmark.* TO 'enigma'@'%' WITH GRANT OPTION" | mysql -u root
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We have noticed, that running benchmarks on Travis CI is a convenient, but not a
* Propel ORM 2.0.0-alpha7
* Yii ActiveRecord 2.0.13.1
* DMS 0.8.2
* Nextras ORM 3.0.0-rc2

## What we test

Expand Down Expand Up @@ -106,6 +107,7 @@ Available providers are:
* `doctrine`
* `activerecord`
* `dms`
* `nextrasorm`

Available tests are:

Expand Down Expand Up @@ -179,6 +181,7 @@ Contributions for new ORMs are more than welcome! If anyone feels that there is
* [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html)
* [PHP ActiveRecord](http://www.phpactiverecord.org/projects/main/wiki)
* [DMS](http://dms-docs.readthedocs.io/en/latest/)
* [Nextras ORM](https://nextras.org/orm/)

## License

Expand Down
9 changes: 9 additions & 0 deletions config/nextrasorm.php
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',
];
9 changes: 9 additions & 0 deletions docker/config/nextrasorm.php
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',
];
17 changes: 17 additions & 0 deletions provider/nextrasorm/Models/Comment.php
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
{
}
13 changes: 13 additions & 0 deletions provider/nextrasorm/Models/CommentsMapper.php
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';
}
}
18 changes: 18 additions & 0 deletions provider/nextrasorm/Models/CommentsRepository.php
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];
}
}
18 changes: 18 additions & 0 deletions provider/nextrasorm/Models/Post.php
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
{
}
13 changes: 13 additions & 0 deletions provider/nextrasorm/Models/PostsMapper.php
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';
}
}
18 changes: 18 additions & 0 deletions provider/nextrasorm/Models/PostsRepository.php
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];
}
}
11 changes: 11 additions & 0 deletions provider/nextrasorm/composer.json
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\\": "./"
}
}
}
Loading

0 comments on commit e318aec

Please sign in to comment.