src/Controller/DefaultController.php
public function getId($aData = [])
    {
        $sIds       = '';
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');

        if (!empty($oInput->get('id'))) {
            $sIds = $oInput->get('id');
        }

        if (!empty($oInput->get('ids'))) {
            $sIds = $oInput->get('ids');
        }

        $aIds = explode(',', $sIds);
        $aIds = array_filter($aIds);
        $aIds = array_unique($aIds);

        if (count($aIds) > self::CONFIG_MAX_ITEMS_PER_REQUEST) {
            throw new ApiException(
                'You can request a maximum of ' . self::CONFIG_MAX_ITEMS_PER_REQUEST . ' items per request',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

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

        $oItemModel = Factory::model(
            static::CONFIG_MODEL_NAME,
            static::CONFIG_MODEL_PROVIDER
        );
        $aResults   = $oItemModel->getByIds($aIds, $aData);

        if ($oInput->get('id')) {
            $oItem = reset($aResults);
            $mData = $oItem ? $this->formatObject($oItem) : null;
        } else {
            $mData = array_map([$this, 'formatObject'], $aResults);
        }

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData($mData);
        return $oResponse;
    }
public function getId($aData = [])
    {
        $sIds       = '';
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');

        if (!empty($oInput->get('id'))) {
            $sIds = $oInput->get('id');
        }

        if (!empty($oInput->get('ids'))) {
            $sIds = $oInput->get('ids');
        }

        $aIds = explode(',', $sIds);
        $aIds = array_filter($aIds);
        $aIds = array_unique($aIds);

        if (count($aIds) > self::CONFIG_MAX_ITEMS_PER_REQUEST) {
            throw new ApiException(
                'You can request a maximum of ' . self::CONFIG_MAX_ITEMS_PER_REQUEST . ' items per request',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

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

        $oItemModel = Factory::model(
            static::CONFIG_MODEL_NAME,
            static::CONFIG_MODEL_PROVIDER
        );
        $aResults   = $oItemModel->getByIds($aIds, $aData);

        if ($oInput->get('id')) {
            $oItem = reset($aResults);
            $mData = $oItem ? $this->formatObject($oItem) : null;
        } else {
            $mData = array_map([$this, 'formatObject'], $aResults);
        }

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData($mData);
        return $oResponse;
    }
Return an item by it's ID, or an array of items by their ID.

@return array