public function getImportByRef($importRef, $dispatchException = false)
    {
        $import = (new ImportQuery)->findOneByRef($importRef);

        if ($import === null && $dispatchException) {
            throw new \ErrorException(
                Translator::getInstance()->trans(
                    'There is no id "%ref" in the imports',
                    [
                        '%ref' => $importRef
                    ]
                )
            );
        }

        return $import;
    }