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
{
22 public function __construct() {
23 parent
::__construct();
27 * Update the household with primary contact id.
29 * @param int $primaryContactId
30 * Null if deleting primary contact.
31 * @param int $contactId
35 * DAO object on success
37 public static function updatePrimaryContact($primaryContactId, $contactId) {
38 $queryString = "UPDATE civicrm_contact
39 SET primary_contact_id = ";
42 if ($primaryContactId) {
44 $params[1] = [$primaryContactId, 'Integer'];
47 $queryString .= "null";
50 $queryString .= " WHERE id = %2";
51 $params[2] = [$contactId, 'Integer'];
53 return CRM_Core_DAO
::executeQuery($queryString, $params);