mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-16 21:08:34 +01:00
* Fix parameter output if parameter is Datetime or array * use array_map for parsing parameters * Add test-case for Doctrine datetime * Fix doctrine query --------- Co-authored-by: Alius <aliusa@users.noreply.github.com>
This commit is contained in:
parent
02d26dbb2e
commit
1b5cabe0ce
BIN
chromedriver
BIN
chromedriver
Binary file not shown.
@ -11,9 +11,10 @@ $debugbar->addCollector(new DebugBar\Bridge\DoctrineCollector($debugStack));
|
||||
|
||||
$product = new Demo\Product();
|
||||
$product->setName("foobar");
|
||||
|
||||
$product->setUpdated();
|
||||
|
||||
$entityManager->persist($product);
|
||||
$entityManager->flush();
|
||||
$entityManager->createQuery("select p from Demo\\Product p where p.updated>:u")->setParameter("u", new \DateTime('1 hour ago'))->execute();
|
||||
$entityManager->createQuery("select p from Demo\\Product p where p.name=:c")->setParameter("c", "<script>alert();</script>")->execute();
|
||||
render_demo_page();
|
||||
|
@ -11,6 +11,8 @@ class Product
|
||||
protected $id;
|
||||
/** @Column(type="string") **/
|
||||
protected $name;
|
||||
/** @Column(type="datetime", nullable=true) **/
|
||||
protected $updated;
|
||||
|
||||
public function getId()
|
||||
{
|
||||
@ -26,4 +28,10 @@ class Product
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function setUpdated(): void
|
||||
{
|
||||
// will NOT be saved in the database
|
||||
$this->updated = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ class DoctrineTest extends AbstractBrowserTest
|
||||
return $node->getText();
|
||||
});
|
||||
|
||||
$this->assertEquals('INSERT INTO products (name) VALUES (?)', $statements[1]);
|
||||
$this->assertCount(4, $statements);
|
||||
$this->assertEquals('INSERT INTO products (name, updated) VALUES (?, ?)', $statements[1]);
|
||||
$this->assertCount(5, $statements);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user