- Mostly bug fixes done on this code push
This commit is contained in:
parent
7de0ecb028
commit
83f673b37f
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Ulmus\Adapter;
|
||||
|
||||
use Ulmus\{ConnectionAdapter, Entity\InformationSchema\Table, Migration\FieldDefinition, Repository, QueryBuilder\Sql\MysqlQueryBuilder};
|
||||
use Ulmus\{ConnectionAdapter, Entity\InformationSchema\Table, Entity, Migration\FieldDefinition, Repository, QueryBuilder\Sql\MysqlQueryBuilder};
|
||||
|
||||
trait DefaultAdapterTrait
|
||||
{
|
||||
|
|
|
@ -207,6 +207,7 @@ class MsSQL implements AdapterInterface, MigrateInterface, SqlAdapterInterface {
|
|||
public function escapeIdentifier(string $segment, int $type) : string
|
||||
{
|
||||
switch($type) {
|
||||
default:
|
||||
case static::IDENTIFIER_SCHEMA:
|
||||
case static::IDENTIFIER_DATABASE:
|
||||
case static::IDENTIFIER_TABLE:
|
||||
|
|
|
@ -76,7 +76,7 @@ trait EntityTrait {
|
|||
elseif ( EntityField::isScalarType($field['type']) ) {
|
||||
|
||||
if ( $field['type'] === 'string' ) {
|
||||
$annotation = $entityResolver->searchFieldAnnotation($field['name'], [ Attribute\Property\Field::class, Field::class ] );
|
||||
$annotation = $entityResolver->searchFieldAnnotation($field['name'], [ Attribute\Property\Field::class, ] );
|
||||
|
||||
if ( $annotation->length ?? null ) {
|
||||
$value = mb_substr($value, 0, $annotation->length);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Ulmus\Event\Repository;
|
||||
|
||||
use Ulmus\EntityCollection;
|
||||
|
||||
interface CollectionFromQueryItemInterface {
|
||||
public function execute(array &$data) : array;
|
||||
}
|
|
@ -16,7 +16,7 @@ trait EventTrait
|
|||
return array_filter($this->eventList, fn($ev) => $ev instanceof $type);
|
||||
}
|
||||
|
||||
public function eventExecute(string $type, ...$arguments) : void
|
||||
public function eventExecute(string $type, &...$arguments) : void
|
||||
{
|
||||
foreach($this->eventFromType($type) as $event) {
|
||||
call_user_func_array([ $event, 'execute'], $arguments);
|
||||
|
|
|
@ -13,9 +13,10 @@ use Ulmus\Annotation\Property\{Field,
|
|||
WithJoin,
|
||||
Relation\Ignore as RelationIgnore};
|
||||
use Ulmus\Common\EntityResolver;
|
||||
use Ulmus\Repository\RepositoryInterface;
|
||||
use Ulmus\Repository\WithOptionEnum;
|
||||
|
||||
class Repository
|
||||
class Repository implements RepositoryInterface
|
||||
{
|
||||
use EventTrait, Repository\ConditionTrait, Repository\EscapeTrait;
|
||||
|
||||
|
@ -869,6 +870,8 @@ class Repository
|
|||
$this->finalizeQuery();
|
||||
|
||||
foreach(Ulmus::iterateQueryBuilder($this->queryBuilder, $this->adapter) as $entityData) {
|
||||
$this->eventExecute(\Ulmus\Event\Repository\CollectionFromQueryItemInterface::class, $entityData);
|
||||
|
||||
$entity = $this->instanciateEntity($entityClass);
|
||||
$entity->loadedFromAdapter = $this->adapter->name;
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Ulmus\Repository;
|
||||
|
||||
interface RepositoryInterface
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue