Entities/Administrators/Model/AdministratorsTableMapper.php
public function getChangedFields(array $changedFields): array 
    {
        $changedAdministratorFields = [];

        foreach ($changedFields as $fieldName => $fieldInfo) {
            if (in_array($fieldName, self::UPDATE_FIELDS)) {
                switch($fieldName) {
                    case 'password':
                        $changedAdministratorFields['password_hash'] = $this->getHashedPassword($changedFields['password']);
                        break;

                    case 'active':
                        $changedAdministratorFields['active'] = Postgres::convertBoolToPostgresBool($changedFields['active']);
                        break;
                        
                    default:
                        $changedAdministratorFields[$fieldName] = $changedFields[$fieldName];
                }
            }
        }

        return $changedAdministratorFields;
    }
public function getChangedFields(array $changedFields): array 
    {
        $changedAdministratorFields = [];

        foreach ($changedFields as $fieldName => $fieldInfo) {
            if (in_array($fieldName, self::UPDATE_FIELDS)) {
                switch($fieldName) {
                    case 'password':
                        $changedAdministratorFields['password_hash'] = $this->getHashedPassword($changedFields['password']);
                        break;

                    case 'active':
                        $changedAdministratorFields['active'] = Postgres::convertBoolToPostgresBool($changedFields['active']);
                        break;
                        
                    default:
                        $changedAdministratorFields[$fieldName] = $changedFields[$fieldName];
                }
            }
        }

        return $changedAdministratorFields;
    }
public function getChangedFields ( array $ changedFields ) : array { $ changedAdministratorFields = [ ] ; foreach ( $ changedFields as $ fieldName => $ fieldInfo ) { if ( in_array ( $ fieldName , self :: UPDATE_FIELDS ) ) { switch ( $ fieldName ) { case 'password' : $ changedAdministratorFields [ 'password_hash' ] = $ this -> getHashedPassword ( $ changedFields [ 'password' ] ) ; break ; case 'active' : $ changedAdministratorFields [ 'active' ] = Postgres :: convertBoolToPostgresBool ( $ changedFields [ 'active' ] ) ; break ; default : $ changedAdministratorFields [ $ fieldName ] = $ changedFields [ $ fieldName ] ; } } } return $ changedAdministratorFields ; }
note this allows any fields to be passed in changedFields and returns only changes from the UPDATE_FIELDS array
note this allows any fields to be passed in changedFields and returns only changes from the UPDATE_FIELDS array