Last active
March 29, 2016 20:04
-
-
Save dantleech/c53749249b24214d200b4f3ea2f10cce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $account = new Account(); | |
| $account->setName('Company'); | |
| $account->setPlaceOfJurisdiction('Feldkirch'); | |
| $this->em->persist($account); | |
| $this->em->flush(); | |
| // echos "1" | |
| echo $this->em->getConnection()->query('SELECT COUNT(*) FROM co_accounts')->fetchColumn(); | |
| $this->em->getConnection()->exec('DELETE FROM co_accounts'); | |
| // does nothing | |
| $this->em->refresh($account); | |
| // state is managed | |
| $state = $this->em->getUnitOfWork()->getEntityState($account); | |
| $account->setName('Bas'); | |
| $this->em->persist($account); | |
| $this->em->flush(); | |
| // echos "0" | |
| echo $this->em->getConnection()->query('SELECT COUNT(*) FROM co_accounts')->fetchColumn(); // 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment