protected function findConfigs($currentFile, array $data, $configName = '', $doLoadJoins = false)
    {
        $configs = array();

        $data = $this->replace($currentFile, $data);

        foreach ($data['configs'] as $name => $config) {

            if (!empty($configName) && $name !== $configName) {
                continue;
            }

            if ($doLoadJoins) {
                $this->loadJoins($currentFile, $config, $data);
            } else {
                $config['joins'] = array();
            }

            $configs[] = new Config($config, $data['orm']);
        }

        if (!$doLoadJoins) {
            $configs = array_shift($configs);
        }

        return $configs;
    }