1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Doctrine\Tests\ORM\Functional\Ticket; |
||
6 | |||
7 | use DateTime, Doctrine\DBAL\Types\Type; |
||
8 | use Doctrine\ORM\Annotation as ORM; |
||
9 | |||
10 | class DDC425Test extends \Doctrine\Tests\OrmFunctionalTestCase |
||
11 | { |
||
12 | protected function setUp() |
||
13 | { |
||
14 | parent::setUp(); |
||
15 | $this->schemaTool->createSchema( |
||
16 | [ |
||
17 | $this->em->getClassMetadata(DDC425Entity::class), |
||
18 | ] |
||
19 | ); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @group DDC-425 |
||
24 | */ |
||
25 | public function testIssue() |
||
26 | { |
||
27 | //$this->em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger); |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | $num = $this->em->createQuery('DELETE '.__NAMESPACE__.'\DDC425Entity e WHERE e.someDatetimeField > ?1') |
||
30 | ->setParameter(1, new DateTime, Type::DATETIME) |
||
31 | ->getResult(); |
||
32 | self::assertEquals(0, $num); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | /** @ORM\Entity */ |
||
37 | class DDC425Entity |
||
38 | { |
||
39 | /** |
||
40 | * @ORM\Id @ORM\Column(type="integer") |
||
41 | * @ORM\GeneratedValue |
||
42 | */ |
||
43 | public $id; |
||
44 | |||
45 | /** @ORM\Column(type="datetime") */ |
||
46 | public $someDatetimeField; |
||
47 | } |
||
48 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.