orm usage
This commit is contained in:
@@ -411,14 +411,14 @@ class EmailAddress extends \Espo\Core\Repositories\Database implements
|
||||
foreach ($toRemoveList as $address) {
|
||||
$emailAddress = $this->getByAddress($address);
|
||||
if ($emailAddress) {
|
||||
$query = "
|
||||
DELETE FROM entity_email_address
|
||||
WHERE
|
||||
entity_id = ".$pdo->quote($entity->id)." AND
|
||||
entity_type = ".$pdo->quote($entity->getEntityType())." AND
|
||||
email_address_id = ".$pdo->quote($emailAddress->id)."
|
||||
";
|
||||
$sth = $pdo->prepare($query);
|
||||
$sql = $this->getEntityManager()->getQuery()->createDeleteQuery('EntityEmailAddress', [
|
||||
'whereClause' => [
|
||||
'entityId' => $entity->id,
|
||||
'entityType' => $entity->getEntityType(),
|
||||
'emailAddressId' => $emailAddress->id,
|
||||
],
|
||||
]);
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,14 +336,14 @@ class PhoneNumber extends \Espo\Core\Repositories\Database implements
|
||||
foreach ($toRemoveList as $number) {
|
||||
$phoneNumber = $this->getByNumber($number);
|
||||
if ($phoneNumber) {
|
||||
$query = "
|
||||
DELETE FROM entity_phone_number
|
||||
WHERE
|
||||
entity_id = ".$pdo->quote($entity->id)." AND
|
||||
entity_type = ".$pdo->quote($entity->getEntityType())." AND
|
||||
phone_number_id = ".$pdo->quote($phoneNumber->id)."
|
||||
";
|
||||
$sth = $pdo->prepare($query);
|
||||
$sql = $this->getEntityManager()->getQuery()->createDeleteQuery('EntityPhoneNumber', [
|
||||
'whereClause' => [
|
||||
'entityId' => $entity->id,
|
||||
'entityType' => $entity->getEntityType(),
|
||||
'phoneNumberId' => $phoneNumber->id,
|
||||
],
|
||||
]);
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user