switch to constructor based value injection
parent
58974e6a8e
commit
c439307d81
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Kartierung;
|
||||||
|
|
||||||
|
use Kartierung\Attribute\Id;
|
||||||
|
|
||||||
|
class EntityWithoutTableAttribute
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
#[Id]
|
||||||
|
public $id
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Kartierung\Sql;
|
||||||
|
|
||||||
|
class EntityWithAllReadMechanics
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public int $publicVal,
|
||||||
|
private int $setterVal
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function getSetterVal(): int
|
||||||
|
{
|
||||||
|
return $this->setterVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kartierung\Sql;
|
|
||||||
|
|
||||||
class EntityWithThreeAccessMethods
|
|
||||||
{
|
|
||||||
public int $publicVal;
|
|
||||||
|
|
||||||
private int $setterVal;
|
|
||||||
|
|
||||||
private int $witherVal;
|
|
||||||
|
|
||||||
public function getSetterVal(): int
|
|
||||||
{
|
|
||||||
return $this->setterVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSetterVal(int $value): void
|
|
||||||
{
|
|
||||||
$this->setterVal = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function withWitherVal(int $value): self
|
|
||||||
{
|
|
||||||
$this->witherVal = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getWitherVal(): int
|
|
||||||
{
|
|
||||||
return $this->witherVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue