- Renamed update() to queryUpdate()
This commit is contained in:
1 parent
7954d83f52
commit
47aa384c4b
3 files changed
+13
-6
No files matched your search
@@ -27,7 +27,7 @@ class EntityResolver {
|
|||||||
|
|
||||||
public string $entityClass;
|
public string $entityClass;
|
||||||
|
|
||||||
public ReflectedClass $reflectedClass;
|
public readonly ReflectedClass $reflectedClass;
|
||||||
|
|
||||||
protected array $fieldList = [];
|
protected array $fieldList = [];
|
||||||
|
|
||||||
@@ -129,6 +129,11 @@ class EntityResolver {
|
|||||||
return $this->reflectedClass->getProperties(true)[$name]->getTypes()[0]->type ?? false;
|
return $this->reflectedClass->getProperties(true)[$name]->getTypes()[0]->type ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function searchPropertyAttributeList(array|string $className, bool $deepSearch = true) : array
|
||||||
|
{
|
||||||
|
return $this->reflectedClass->getPropertyAttributeListFromClassname($className, $deepSearch, false);
|
||||||
|
}
|
||||||
|
|
||||||
public function searchFieldAnnotation(string $field, array|object|string $annotationType, bool $caseSensitive = true) : ? object
|
public function searchFieldAnnotation(string $field, array|object|string $annotationType, bool $caseSensitive = true) : ? object
|
||||||
{
|
{
|
||||||
return $this->searchFieldAnnotationList($field, $annotationType, $caseSensitive)[0] ?? null;
|
return $this->searchFieldAnnotationList($field, $annotationType, $caseSensitive)[0] ?? null;
|
||||||
@@ -136,8 +141,6 @@ class EntityResolver {
|
|||||||
|
|
||||||
public function searchFieldAnnotationList(string $field, array|object|string $attributeType, bool $caseSensitive = true) : false|array
|
public function searchFieldAnnotationList(string $field, array|object|string $attributeType, bool $caseSensitive = true) : false|array
|
||||||
{
|
{
|
||||||
$list = [];
|
|
||||||
|
|
||||||
$properties = $this->reflectedClass->getProperties(true);
|
$properties = $this->reflectedClass->getProperties(true);
|
||||||
|
|
||||||
$search = $caseSensitive ? $properties : array_change_key_case($properties, \CASE_LOWER);
|
$search = $caseSensitive ? $properties : array_change_key_case($properties, \CASE_LOWER);
|
||||||
|
|||||||
+5
-1
@@ -369,7 +369,11 @@ class Repository implements RepositoryInterface
|
|||||||
$dataset = $this->generateDatasetDiff($entity, $oldValues);
|
$dataset = $this->generateDatasetDiff($entity, $oldValues);
|
||||||
|
|
||||||
foreach($dataset as $field => $value) {
|
foreach($dataset as $field => $value) {
|
||||||
if ( false === ( $this->entityResolver->searchFieldAnnotation($field, Field::class, false)->readonly ?? false ) ) {
|
$readonly = $this->entityResolver->searchFieldAnnotation($field, Field::class, false)->readonly ??
|
||||||
|
$this->entityResolver->searchField($field)->getAttribute(Field::class)->object->readonly ??
|
||||||
|
false;
|
||||||
|
|
||||||
|
if ( ! $readonly ) {
|
||||||
$intersect[$field] = $field;
|
$intersect[$field] = $field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ trait QueryBuildingTrait
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(string $table, string $alias, ? string $schema) : self
|
public function queryUpdate(string $table, string $alias, ? string $schema) : self
|
||||||
{
|
{
|
||||||
$this->queryBuilder->update($this->escapeTable($table), $alias ? $this->escapeIdentifier($alias) : null, $this->escapedDatabase(), $schema);
|
$this->queryBuilder->update($this->escapeTable($table), $alias ? $this->escapeIdentifier($alias) : null, $this->escapedDatabase(), $schema);
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ trait QueryBuildingTrait
|
|||||||
protected function updateSqlQuery(array $dataset) : self
|
protected function updateSqlQuery(array $dataset) : self
|
||||||
{
|
{
|
||||||
if ( null === $this->queryBuilder->getFragment(Query\Update::class) ) {
|
if ( null === $this->queryBuilder->getFragment(Query\Update::class) ) {
|
||||||
$this->update($this->entityResolver->tableName(), $this->alias, $this->entityResolver->schemaName());
|
$this->queryUpdate($this->entityResolver->tableName(), $this->alias, $this->entityResolver->schemaName());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set($dataset);
|
$this->set($dataset);
|
||||||
|
|||||||
Reference in new issue
Block a user