Skip to content

Commit c67ac1d

Browse files
authored
Merge pull request #23 from mringler/tests/always_close_statements
Tests/always close statements
2 parents 70a599b + c9c37d3 commit c67ac1d

20 files changed

+307
-302
lines changed

src/Propel/Runtime/Formatter/ArrayFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public function format(?DataFetcherInterface $dataFetcher = null)
4040
$collection = $this->getCollection();
4141

4242
if ($this->isWithOneToMany() && $this->hasLimit) {
43+
$dataFetcher->close();
44+
4345
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
4446
}
4547

@@ -83,6 +85,8 @@ public function formatOne(?DataFetcherInterface $dataFetcher = null): ?array
8385
$result = null;
8486

8587
if ($this->isWithOneToMany() && $this->hasLimit) {
88+
$dataFetcher->close();
89+
8690
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
8791
}
8892

src/Propel/Runtime/Formatter/ObjectFormatter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public function format(?DataFetcherInterface $dataFetcher = null)
4545

4646
if ($this->isWithOneToMany()) {
4747
if ($this->hasLimit) {
48+
$dataFetcher->close();
49+
4850
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
4951
}
5052
foreach ($dataFetcher as $row) {

src/Propel/Runtime/Formatter/OnDemandFormatter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function format(?DataFetcherInterface $dataFetcher = null): OnDemandColle
6161
}
6262

6363
if ($this->isWithOneToMany()) {
64+
$dataFetcher->close();
65+
6466
throw new LogicException('OnDemandFormatter cannot hydrate related objects using a one-to-many relationship. Try removing with() from your query.');
6567
}
6668

src/Propel/Runtime/Formatter/SimpleArrayFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function format(?DataFetcherInterface $dataFetcher = null)
4141
$collection = $this->getCollection();
4242

4343
if ($this->isWithOneToMany() && $this->hasLimit) {
44+
$dataFetcher->close();
45+
4446
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
4547
}
4648

@@ -76,6 +78,8 @@ public function formatOne(?DataFetcherInterface $dataFetcher = null)
7678
$result = null;
7779

7880
if ($this->isWithOneToMany() && $this->hasLimit) {
81+
$dataFetcher->close();
82+
7983
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
8084
}
8185

tests/Propel/Tests/Generator/Behavior/OutputGroup/GeneratedTableMapOutputGroupTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class GeneratedTableMapOutputGroupTest extends TestCase
1919
*/
2020
public static function setUpBeforeClass(): void
2121
{
22+
parent::setUpBeforeClass();
2223
if (!class_exists('GeneratedTableMapOutputGroupTestTable')) {
2324
static::buildLocalSchemaClasses();
2425
}

tests/Propel/Tests/Generator/Behavior/OutputGroup/OutputGroupBehaviorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class OutputGroupBehaviorTest extends TestCase
2424
*/
2525
public static function setUpBeforeClass(): void
2626
{
27+
parent::setUpBeforeClass();
2728
if (!class_exists('OgEmployee')) {
2829
static::buildLocalSchemaClasses();
2930
}

tests/Propel/Tests/Generator/Behavior/Versionable/VersionableBehaviorObjectBuilderModifierTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class VersionableBehaviorObjectBuilderModifierTest extends TestCase
5454
*/
5555
public static function setUpBeforeClass(): void
5656
{
57+
parent::setUpBeforeClass();
5758
$schema = <<<EOF
5859
<database name="versionable_behavior_test_1">
5960
<table name="versionable_behavior_test_1">

0 commit comments

Comments
 (0)