This method applies the conditionals which are common across the get_*()
methods and the count() method.

@param array $aData Data passed from the calling method

@return void
326005
protected function getCountCommon(array $aData = [])
    {
        //  @deprecated - searching should use the search() method, but this in place
        //  as a quick fix for loads of admin controllers
        if (!empty($aData['keywords']) && !empty($this->searchableFields)) {
            if (empty($aData['or_like'])) {
                $aData['or_like'] = [];
            }

            $sAlias = $this->getTableAlias(true);

            foreach ($this->searchableFields as $mField) {

                //  If the field is an array then search across the columns concatenated together
                if (is_array($mField)) {

                    $sMappedFields = array_map(function ($sInput) use ($sAlias) {
                        if (strpos($sInput, '.') !== false) {
                            return $sInput;
                        } else {
                            return $sAlias . $sInput;
                        }
                    }, $mField);

                    $aData['or_like'][] = ['CONCAT_WS(" ", ' . implode(',', $sMappedFields) . ')', $aData['keywords']];

                } else {
                    if (strpos($mField, '.') !== false) {
                        $aData['or_like'][] = [$mField, $aData['keywords']];
                    } else {
                        $aData['or_like'][] = [$sAlias . $mField, $aData['keywords']];
                    }
                }
            }
        }

        // --------------------------------------------------------------------------

        $this->getCountCommonCompileSelect($aData);
        $this->getCountCommonCompileFilters($aData);
        $this->getCountCommonCompileWheres($aData);
        $this->getCountCommonCompileLikes($aData);
        $this->getCountCommonCompileHavings($aData);
        $this->getCountCommonCompileSort($aData);
    }
980533
protected function triggerEvent($sEvent, array $aData)
    {
        if ($sEvent) {
            Factory::service('Event')
                ->trigger(
                    $sEvent,
                    static::getEventNamespace(),
                    $aData
                );
        }
    }
1114688
public function render($aData)
    {
        if (empty($aData['likertTerms'])) {
            $aData['likertTerms'] = $this->aLikertTerms;
        }

        $oView = Factory::service('View');
        $sOut  = $oView->load('formbuilder/fields/open', $aData, true);
        $sOut  .= $oView->load('formbuilder/fields/body-likert', $aData, true);
        $sOut  .= $oView->load('formbuilder/fields/close', $aData, true);

        return $sOut;
    }
879461
protected function &_NewElement(&$aData)
    {
        if (!empty($aData['class'])) {
            $sClassName = $aData['class'];
            $oElement = new $sClassName();
            $oElement->LoadFromRow($aData);

            return $oElement;
        } else {
            return parent::_NewElement($aData);
        }
    }
705742
public function UserQuery($SafeData = FALSE) {
      if ($SafeData) {
         $this->SQL->Select('u.UserID, u.Name, u.Photo, u.About, u.Gender, u.CountVisits, u.InviteUserID, u.DateFirstVisit, u.DateLastActive, u.DateInserted, u.DateUpdated, u.Score, u.Admin, u.Deleted, u.CountDiscussions, u.CountComments');
      } else {
         $this->SQL->Select('u.*');
      }
      $this->SQL->From('User u');
//      $this->SQL->Select('i.Name', '', 'InviteName')
//         ->From('User u')
//         ->Join('User as i', 'u.InviteUserID = i.UserID', 'left');
   }
964429
public function submit(array $inputData = [])
    {
        $this->validated = false;
        $this->isSubmitted = true;
        $this->isValid = true;

        /** @var ElementInterface $element */
        foreach ($this->elements() as $name => $element) {
            if ($element->isDisabled()) {
                continue;
            }
            $value = $inputData[$name] ?? '';
            $this->rawData[$name] = $value;
            $value = $this->filter($name, $value);
            $this->data[$name] = $value;
            $element->withValue($value);

            // only validate elements which are not disabled.
            if (! $this->validate($name, $element->value())) {
                $this->isValid = false;
            }
        }
    }
261907
private function executePostConnectionOptions(\stdClass $initData)
    {
        if (isset($initData->password)) {
            $this->authenticate($initData->password);
        }
        if (isset($initData->database)) {
            $this->selectDatabase($initData->database);
        }
    }
833732
protected function setAsShadowOf(NodeData $nodeData = null)
    {
        $this->setMovedTo($nodeData);
        $this->setRemoved(($nodeData !== null));
        $this->addOrUpdate();
    }
1109465
public function setDeletedAtDateTime(?DateTime $deletedAt): void
    {
        $this->deleted_at = $deletedAt === null ? null : $deletedAt->format('Y-m-d H:i:s');
    }
785144
public function add(Array $addData)
    {
        $addFields = array();
        $addValues = array();
        foreach ($addData as $key => $value) {
            $addFields[] = $key;
            $addValues[] = '\'' . $value . '\'';
        }
        $fields = implode(',', $addFields);
        $values = implode(',', $addValues);
        $this->sql = "INSERT INTO {$this->_table} ($fields)VALUES($values)";
        return $this->execute()->rowCount();
    }
1143795
protected function askQuestionExecute($aData)
    {
        $oMailProfile = TdbDataMailProfile::GetProfile('product-info-request');
        $oMailProfile->AddDataArray($aData);
        // now add product info as well
        /** @var $oActiveProduct TdbShopArticle */
        $oActiveProduct = TdbShop::GetActiveItem();
        $aArticleData = $oActiveProduct->GetObjectPropertiesAsArray();
        $oMailProfile->AddDataArray($aArticleData);
        // add link to article

        $sLink = $oActiveProduct->getLink(true, null, array(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => null));
        $oMailProfile->AddData('sLink', $sLink);
        $oMailProfile->ChangeFromAddress($aData['email'], $aData['name']);
        $oMailProfile->SendUsingObjectView('emails', 'Customer');

        $oMsgManager = TCMSMessageManager::GetInstance();
        $oMsgManager->AddMessage($this->sModuleSpotName, 'QUESTION-SEND');

        $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain());
    }
933637
public function getCountCommonObjects($aData = [])
    {
        if (!empty($aData['keywords'])) {
            if (empty($aData['or_like'])) {
                $aData['or_like'] = [];
            }
            $aData['or_like'][] = [
                'column' => 'o.filename_display',
                'value'  => $aData['keywords'],
            ];
        }

        $this->getCountCommon($aData);
    }
96037
public function initialize(array $initialData = []) : void
    {
        foreach ($initialData as $key => $value) {
            $this[$key] = $value;
        }
    }
1216108
public function init(\stdClass $initData = null)
    {
        if ($initData === null) {
            $this->connection->connect();
        } else {
            $this->openConnection($initData);
        }
    }
988357
protected function getCountCommonCompileSort(array &$aData)
    {
        $oDb = Factory::service('Database');

        if (!empty($aData['sort'])) {

            /**
             * How we handle sorting
             * =====================
             *
             * - If $aData['sort'] is a string assume it's the field to sort on, use the default order
             * - If $aData['sort'] is a single dimension array then assume the first element (or the element
             *   named 'column') is the column; and the second element (or the element named 'order') is the
             *   direction to sort in
             * - If $aData['sort'] is a multidimensional array then loop each element and test as above.
             *
             **/

            if (is_string($aData['sort'])) {

                //  String
                $oDb->order_by($aData['sort']);

            } elseif (is_array($aData['sort'])) {

                $mFirst = reset($aData['sort']);

                if (is_string($mFirst)) {

                    //  Single dimension array
                    $aSort = $this->getCountCommonParseSort($aData['sort']);

                    if (!empty($aSort['column'])) {
                        $oDb->order_by($aSort['column'], $aSort['order']);
                    }

                } else {

                    //  Multi dimension array
                    foreach ($aData['sort'] as $sort) {

                        $aSort = $this->getCountCommonParseSort($sort);

                        if (!empty($aSort['column'])) {
                            $oDb->order_by($aSort['column'], $aSort['order']);
                        }
                    }
                }
            }

        }
    }
151669
protected function verifyExpiration(array $tokenData)
    {
        if (!isset($tokenData['expirationDateTime'])) {
            return;
        }
        $expirationDateTime = \DateTime::createFromFormat(\DateTime::ISO8601, $tokenData['expirationDateTime']);
        if ($this->now instanceof DependencyProxy) {
            $this->now->_activateDependency();
        }
        if ($expirationDateTime < $this->now) {
            throw new AccessDeniedException(sprintf('Token expired!%sThis token expired at "%s"', chr(10),
                $expirationDateTime->format(\DateTime::ISO8601)), 1429697439);
        }
    }
876568
public function stream_write($aData)
    {
        if ($this->write) {
            $left = substr(self::$string[$this->path], 0, $this->position);
            $right = substr(self::$string[$this->path], $this->position + strlen($aData));
            self::$string[$this->path] = $left . $aData . $right;
            $this->position += strlen($aData);
            return strlen($aData);
        } else {
            return false;
        }
    }