Permalink
Browse files

Issue #10 move bindValue to numeric to avoid SQLSTATE[HY093] on "init…

…ListMyObjectAssociatedsPKs"
  • Loading branch information...
Lionel09 committed Dec 12, 2012
1 parent 85b91f2 commit 9da11ce5abce01d5e5a5b18b1db90deb6e3ed5f0
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/templates/parent/addInitListRelatedPKs.php
@@ -28,17 +28,18 @@ protected function initList<?php echo $pluralRefTableName ?>PKs(PropelPDO $con =
<?php echo $tablePk ?> IN (
SELECT <?php echo $refColumn1 . "\n" ?>
FROM <?php echo $middleTableName . "\n" ?>
- WHERE <?php echo $refColumn2 ?> = :<?php echo $pkName . "\n" ?>
+ WHERE <?php echo $refColumn2 ?> = ?
)
OR
<?php echo $tablePk ?> IN (
SELECT <?php echo $refColumn2 . "\n" ?>
FROM <?php echo $middleTableName . "\n" ?>
- WHERE <?php echo $refColumn1 ?> = :<?php echo $pkName . "\n" ?>
+ WHERE <?php echo $refColumn1 ?> = ?
)";
$stmt = $con->prepare($sql);
- $stmt->bindValue(':<?php echo $pkName ?>', $this->getPrimaryKey(), PDO::PARAM_INT);
+ $stmt->bindValue(1, $this->getPrimaryKey(), PDO::PARAM_INT);
+ $stmt->bindValue(2, $this->getPrimaryKey(), PDO::PARAM_INT);
$stmt->execute();
$this-><?php echo $varListRelatedPKs ?> = $stmt->fetchAll(PDO::FETCH_COLUMN);

0 comments on commit 9da11ce

Please sign in to comment.