It works with this :

                  // Remove Pets 
                   $sql = "delete from pet where type_id = ?";
                   $countpet = $dbal->executeUpdate($sql, 
array($pt->getId()));

Strange :-\

Le mardi 21 janvier 2014 20:11:36 UTC+1, David R a écrit :
>
> Hello,
>
> I do not understand why DBAL execute statement return 1 and not the number 
> of rows affected.
> Any idea ?
>
>
>               $dbal = $this->get('database_connection');
>               $dbal->beginTransaction();
>               try {
>
>                     // Remove Pets 
>                    $sql = "delete from pet where type_id = ?";
>                    $stmt1 = $dbal->prepare($sql);
>                    $stmt1->bindValue(1, $pt->getId());
>                    $countpet = $stmt1->execute();
>
>                    // Remove Pet Type
>                    $sql = "delete from pettype where id = ?";
>                    $stmt3 = $dbal->prepare($sql);
>                    $stmt3->bindValue(1, $pt->getId());
>                    $counttype = $stmt3->execute();
>
>                    // Commit transaction
>                    $dbal->commit();
>                    ====>> $countype and $countpet =1 whereas lots of rows 
> affected.
>                   
>               } catch (\Exception $e) {
>                    $dbal->rollback();
>                    throw $e;
>               }
>
> I check in database, 26 pets have been removed and 1 pettype.
>
> Help appreciate.
> Thanks.
> David.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to