-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add more cases to test filter combinations
- Loading branch information
Showing
4 changed files
with
754 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace ipl\Tests\Orm\Lib\Model; | ||
|
||
use ipl\Orm\Model; | ||
use ipl\Orm\Relations; | ||
|
||
class Department extends Model | ||
{ | ||
public function getTableName() | ||
{ | ||
return 'department'; | ||
} | ||
|
||
public function getKeyName() | ||
{ | ||
return 'id'; | ||
} | ||
|
||
public function getColumns() | ||
{ | ||
return [ | ||
'name' | ||
]; | ||
} | ||
|
||
public function createRelations(Relations $relations) | ||
{ | ||
$relations->hasMany('employee', Employee::class) | ||
->setJoinType('LEFT'); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
namespace ipl\Tests\Orm\Lib\Model; | ||
|
||
use ipl\Orm\Model; | ||
use ipl\Orm\Relations; | ||
|
||
class Employee extends Model | ||
{ | ||
public function getTableName() | ||
{ | ||
return 'employee'; | ||
} | ||
|
||
public function getKeyName() | ||
{ | ||
return 'id'; | ||
} | ||
|
||
public function getColumns() | ||
{ | ||
return [ | ||
'name', | ||
'role', | ||
'department_id', | ||
'office_id' | ||
]; | ||
} | ||
|
||
public function createRelations(Relations $relations) | ||
{ | ||
$relations->belongsTo('department', Department::class); | ||
$relations->belongsTo('office', Office::class) | ||
->setJoinType('LEFT'); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace ipl\Tests\Orm\Lib\Model; | ||
|
||
use ipl\Orm\Model; | ||
use ipl\Orm\Relations; | ||
|
||
class Office extends Model | ||
{ | ||
public function getTableName() | ||
{ | ||
return 'office'; | ||
} | ||
|
||
public function getKeyName() | ||
{ | ||
return 'id'; | ||
} | ||
|
||
public function getColumns() | ||
{ | ||
return [ | ||
'city' | ||
]; | ||
} | ||
|
||
public function createRelations(Relations $relations) | ||
{ | ||
$relations->hasMany('employee', Employee::class); | ||
} | ||
} |
Oops, something went wrong.