Skip to content

Commit

Permalink
Add support for Lean Mapper 4
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha authored and mibk committed Mar 19, 2021
1 parent c866d86 commit c4007d4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/LeanMapperQuery/Query.filters.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Author extends Entity

class BookRepository extends Repository
{
public function createFluent()
public function createFluent(): LeanMapper\Fluent
{
return parent::createFluent();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/LeanMapperQuery/Query.joins.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ require_once __DIR__ . '/../bootstrap.php';

class Test2Mapper extends TestMapper
{
public function getPrimaryKey($table)
public function getPrimaryKey($table): string
{
if ($table === 'author') {
return 'id_author';
}
return 'id';
}

public function getRelationshipColumn($sourceTable, $targetTable)
public function getRelationshipColumn($sourceTable, $targetTable, ?string $relationshipName = NULL): string
{
return $targetTable . '_id';
}
Expand Down
8 changes: 4 additions & 4 deletions tests/LeanMapperQuery/single-table-inheritance.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BaseRepository extends Repository

class ClientMapper extends TestMapper implements LeanMapperQuery\ICaster
{
public function getEntityClass($table, LeanMapper\Row $row = null)
public function getEntityClass($table, LeanMapper\Row $row = null): string
{
if ($table === 'client') {
if (isset($row->type)) {
Expand All @@ -48,7 +48,7 @@ class ClientMapper extends TestMapper implements LeanMapperQuery\ICaster
return parent::getEntityClass($table, $row);
}

public function getTable($entity)
public function getTable($entity): string
{
if ($entity === 'ClientIndividual' || $entity === 'ClientCompany') {
return 'client';
Expand Down Expand Up @@ -93,7 +93,7 @@ abstract class Client extends BaseEntity
*/
class ClientIndividual extends Client
{
protected function initDefaults()
protected function initDefaults(): void
{
$this->type = self::TYPE_INDIVIDUAL;
}
Expand All @@ -105,7 +105,7 @@ class ClientIndividual extends Client
*/
class ClientCompany extends Client
{
protected function initDefaults()
protected function initDefaults(): void
{
$this->type = self::TYPE_COMPANY;
}
Expand Down
5 changes: 4 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

class TestMapper extends DefaultMapper
{
protected $defaultEntityNamespace = null;
public function __construct()
{
$this->defaultEntityNamespace = null;
}
}

$connection = new Connection([
Expand Down
2 changes: 1 addition & 1 deletion tests/dependencies/Fluent.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require_once __DIR__ . '/../bootstrap.php';

class TestRepository extends Repository
{
public function createFluent()
public function createFluent(): LeanMapper\Fluent
{
return parent::createFluent();
}
Expand Down

0 comments on commit c4007d4

Please sign in to comment.