3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_Contact_BAO_Household
extends CRM_Contact_DAO_Contact
{
20 * Update the household with primary contact id.
22 * @param int $primaryContactId
23 * Null if deleting primary contact.
24 * @param int $contactId
28 * DAO object on success
30 public static function updatePrimaryContact($primaryContactId, $contactId) {
31 $queryString = "UPDATE civicrm_contact
32 SET primary_contact_id = ";
35 if ($primaryContactId) {
37 $params[1] = [$primaryContactId, 'Integer'];
40 $queryString .= "null";
43 $queryString .= " WHERE id = %2";
44 $params[2] = [$contactId, 'Integer'];
46 return CRM_Core_DAO
::executeQuery($queryString, $params);