Skip to content

Commit 111e996

Browse files
committed
minor #9680 9677 price is an integer (alexislefebvre)
This PR was squashed before being merged into the 4.0 branch (closes #9680). Discussion ---------- 9677 price is an integer Fixes #9677. Price was stored as an integer but a float was provided to `setPrice()`. I harmonised the calls in order to use integer only. Commits ------- 81066ad 9677 price is an integer
2 parents 4b05895 + 81066ad commit 111e996

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

doctrine.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ and save it!
335335
336336
$product = new Product();
337337
$product->setName('Keyboard');
338-
$product->setPrice(19.99);
338+
$product->setPrice(1999);
339339
$product->setDescription('Ergonomic and stylish!');
340340
341341
// tell Doctrine you want to (eventually) save the Product (no queries yet)
@@ -441,7 +441,7 @@ Once you have a repository object, you have many helper methods::
441441
// or find by name and price
442442
$product = $repository->findOneBy([
443443
'name' => 'Keyboard',
444-
'price' => 19.99,
444+
'price' => 1999,
445445
]);
446446

447447
// look for multiple Product objects matching the name, ordered by price
@@ -624,7 +624,7 @@ This uses Doctrine's `Query Builder`_: a very powerful and user-friendly way to
624624
write custom queries. Now, you can call this method on the repository::
625625

626626
// from inside a controller
627-
$minPrice = 10;
627+
$minPrice = 1000;
628628

629629
$products = $this->getDoctrine()
630630
->getRepository(Product::class)
@@ -654,7 +654,7 @@ In addition to the query builder, you can also query with `Doctrine Query Langua
654654
FROM App\Entity\Product p
655655
WHERE p.price > :price
656656
ORDER BY p.price ASC'
657-
)->setParameter('price', 10);
657+
)->setParameter('price', 1000);
658658

659659
// returns an array of Product objects
660660
return $query->execute();
@@ -675,7 +675,7 @@ Or directly with SQL if you need to::
675675
ORDER BY p.price ASC
676676
';
677677
$stmt = $conn->prepare($sql);
678-
$stmt->execute(['price' => 10]);
678+
$stmt->execute(['price' => 1000]);
679679

680680
// returns an array of arrays (i.e. a raw data set)
681681
return $stmt->fetchAll();

quick_tour/flex_recipes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ rich API for a ``product`` table? Create a ``Product`` entity and give it the
213213
private $name;
214214

215215
/**
216-
* @ORM\Column(type="string")
216+
* @ORM\Column(type="int")
217217
*/
218218
private $price;
219219

0 commit comments

Comments
 (0)