just another orm...
View the Project on GitHub tflori/orm
» API Reference » ORM\Testing\EntityFetcherMock\ResultRepository
Name | Value |
---|---|
RANDOM_KEY_MIN | 1000000000 |
RANDOM_KEY_MAX | 1000999999 |
public function __construct(\ORM\EntityManager $em)
Parameter | Type | Description |
---|---|---|
$em |
ORM\EntityManager |
ORM\Testing\EntityFetcherMock\ResultRepository::__construct
public function addEntity(\ORM\Entity $entity): mixed
The entity needs to have a primary key if not it will be filled with random values between RANDOM_KEY_MIN and RANDOM_KEY_MAX (at the time writing this it is 1000000000 and 1000999999).
You can pass mocks from Entity too but we need to call Entity::getPrimaryKey()
.
Returns | mixed |
Parameter | Type | Description |
---|---|---|
$entity |
ORM\Entity |
ORM\Testing\EntityFetcherMock\ResultRepository::addEntity
public function addResult(
mixed $class,
\ORM\Entity $entities,
): \ORM\Testing\EntityFetcherMock\Result|\Mockery\MockInterface
As the results are mocked to come from the database they will also get a primary key if they don’t have already.
Returns | ORM\Testing\EntityFetcherMock\Result|Mockery\MockInterface |
Parameter | Type | Description |
---|---|---|
$class |
mixed | |
$entities |
ORM\Entity |
ORM\Testing\EntityFetcherMock\ResultRepository::addResult
public static function completePrimaryKeys(\ORM\Entity $entities): \ORM\Entity[]
If the primary key is incomplete the missing attributes will be filled with a random integer between RANDOM_KEY_MIN and RANDOM_KEY_MAX (at the time writing this it is 1000000000 and 1000999999).
Static | This method is static. | |
Returns | ORM\Entity[] |
Parameter | Type | Description |
---|---|---|
$entities |
ORM\Entity |
ORM\Testing\EntityFetcherMock\ResultRepository::completePrimaryKeys
public function getResults(string $class, \ORM\EntityFetcher $fetcher): array
The EntityFetcherMock\Result gets a quality for matching this query. Only the highest quality will be used.
Returns | array |
Parameter | Type | Description |
---|---|---|
$class |
string | |
$fetcher |
ORM\EntityFetcher |
ORM\Testing\EntityFetcherMock\ResultRepository::getResults
public function retrieve(string $class, array $primaryKey): \ORM\Entity|null
Returns | ORM\Entity|null |
Parameter | Type | Description |
---|---|---|
$class |
string | |
$primaryKey |
array |
ORM\Testing\EntityFetcherMock\ResultRepository::retrieve