Reputation: 92
I am wondering if there are any equivalent to $em->persist($entity) or $em->flush() with DBAL ?
I'm meaning, how DBAL work with entity ? I'm working with entity not handled by doctrine : data to hydrate entity is retrieved with DBAL using SELECT ..., and if I have to update stuff in database, do I have to use DBAL insert()/update() functions as stated here : http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html ?
Do you know a simple way to record changes made to an entity while using a form ?
I hope i was understandable, thank you for reading.
Upvotes: 1
Views: 346
Reputation: 10910
In DBAL
you have no entities since this is just Database Abstraction Layer - its responsibility is to make sure that when you run a query it will be run properly on various DB engines.
Dealing with Entities is a responsibility of Object-Relational Mapping library (like DoctrineORM
).
So there is no equivalent of flush
or persist
in DBAL
. To perform update on DB you need to run query like
$conn->executeUpdate('UPDATE user SET username = ? WHERE id = ?', array('jwage', 1))
Upvotes: 1