Skip to content

Commit 749cb06

Browse files
committed
Set test
1 parent 0814554 commit 749cb06

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

src/Database/Database.php

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6665,20 +6665,30 @@ public function convertQueries(Document $collection, array $queries): array
66656665
foreach ($attributes as $attribute) {
66666666
foreach ($queries as $index => $query) {
66676667
if ($query->getAttribute() === $attribute->getId()) {
6668-
// if($query->getAttribute() === '$sequence'){
6669-
// /**
6670-
// * Hack for Postgres, since bindParam does not convert '' on int attribute
6671-
// */
6672-
// $values = $query->getValues();
6673-
// foreach ($values as $valueIndex => $value) {
6674-
// if($value === ''){
6675-
// $values[$valueIndex] = '0';
6676-
// }
6677-
// }
6678-
// $query->setValues($values);
6679-
// $queries[$index] = $query;
6680-
// }
6668+
/**
6669+
* Hack test - Remove this:
6670+
*/
6671+
6672+
if($query->getAttribute() === '$sequence'){
6673+
/**
6674+
* Hack for Postgres, since bindParam does not convert '' on int attribute
6675+
*/
6676+
$values = $query->getValues();
6677+
foreach ($values as $valueIndex => $value) {
6678+
// if($value === ''){
6679+
// $values[$valueIndex] = '0';
6680+
// }
6681+
if(empty($value)){
6682+
throw new DatabaseException\Structure('Shmuel tests');
6683+
}
6684+
}
6685+
$query->setValues($values);
6686+
$queries[$index] = $query;
6687+
}
66816688

6689+
/**
6690+
* End test
6691+
*/
66826692
$query->setOnArray($attribute->getAttribute('array', false));
66836693
}
66846694
}

src/Database/Document.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ public function getId(): string
7070
*/
7171
public function getSequence(): string
7272
{
73-
/**
74-
* This can be a better fix ?
75-
* Since we always check logic by empty($document->getSequence()
76-
*/
7773
return $this->getAttribute('$sequence', '0');
78-
//return $this->getAttribute('$sequence', '');
7974
}
8075

8176
/**

0 commit comments

Comments
 (0)