mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
Remove calls to dropped orders table
This commit is contained in:
@@ -12,6 +12,18 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class OrderRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Returns the orders initiated by a given user.
|
||||
*
|
||||
* @param \User_Adapter $user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findByUser(\User_Adapter $user)
|
||||
{
|
||||
return $this->findBy(array('usrId' => $user->get_id()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the orders, starting at $offsetStart, limited to $perPage
|
||||
*
|
||||
|
@@ -768,6 +768,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
$this->app['EM']->remove($export);
|
||||
}
|
||||
|
||||
$repo = $this->app['EM']->getRepository('Entities\Order');
|
||||
foreach ($repo->findByUser($this) as $order) {
|
||||
$this->app['EM']->remove($order);
|
||||
}
|
||||
|
||||
$this->app['EM']->flush();
|
||||
|
||||
$sql = 'UPDATE usr SET usr_login = :usr_login , usr_mail = null
|
||||
@@ -796,11 +801,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
$stmt->execute(array(':usr_id' => $this->get_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'DELETE FROM `order` WHERE usr_id = :usr_id';
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $this->get_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = 'DELETE FROM sselnew WHERE usr_id = :usr_id';
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $this->get_id()));
|
||||
|
Reference in New Issue
Block a user