Extended class triggering forbidden functions

Hello.

Since my custom filter was triggering an error ("$in requires an array"), i created a new PHP file containing a "CustomFilterApi" class that extends FilterApi class, so then i was able to change some FilterApi's functions and bypass my filter's error. But when i extend the FilterApi class, it triggers some forbidden functions.

There's my CustomFilterApi code:

<?php

/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */

require_once ("clients/base/api/FilterApi.php");

class CustomFilterApi extends FilterApi
{
	protected static function addFilters(array $filterDefs, SugarQuery_Builder_Where $where, SugarQuery $q)
    {
        foreach ($filterDefs as $filterDef) {
            if (!is_array($filterDef)) {
				$filterDef = array($filterDef);
                /*throw new SugarApiExceptionInvalidParameter(
                    sprintf(
                        'Did not recognize the definition: %s',
                        print_r($filterDef, true)
                    )
                );*/
            }
            foreach ($filterDef as $field => $filter) {
                parent::addFilter($field, $filter, $where, $q);
            }
        }
    }
}

Error screenshot:

/resized-image/__size/319x137/__key/communityserver-discussions-components-files/42/EVIDENCE1.png

  • I would not recommend circumventing an error message like that, clearly it is trying to tell you that your filter is not going to work. Removing the error message would just lead to the execution of code that won't work.

    The image from your error is too small to read, and too fuzzy when zoomed in. But I would say you need to figure out why your custom filter is not defined correctly. What is it that you are trying to achineve?

    FrancescaS