add app to installer

This commit is contained in:
Dennis Eichhorn 2021-06-24 00:03:34 +02:00
parent 1d1e03943e
commit a98e51dd45
2 changed files with 9 additions and 8 deletions

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Modules\Navigation\Admin\Install; namespace Modules\Navigation\Admin\Install;
use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\Application\ApplicationAbstract;
/** /**
* Search class. * Search class.
@ -30,14 +30,14 @@ final class Search
* Install navigation providing * Install navigation providing
* *
* @param string $path Module path * @param string $path Module path
* @param DatabasePool $dbPool Database pool for database interaction * @param ApplicationAbstract $app Application
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function install(string $path, DatabasePool $dbPool) : void public static function install(string $path, ApplicationAbstract $app) : void
{ {
\Modules\Search\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/SearchCommands.php']); \Modules\Search\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/SearchCommands.php']);
} }
} }

View File

@ -19,6 +19,7 @@ use Modules\Navigation\Models\NavElementMapper;
use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\InstallerAbstract; use phpOMS\Module\InstallerAbstract;
use phpOMS\System\File\PathException; use phpOMS\System\File\PathException;
use phpOMS\Application\ApplicationAbstract;
/** /**
* Installer class. * Installer class.
@ -33,7 +34,7 @@ final class Installer extends InstallerAbstract
/** /**
* Install data from providing modules. * Install data from providing modules.
* *
* @param DatabasePool $dbPool Database pool * @param ApplicationAbstract $app Application
* @param array $data Module info * @param array $data Module info
* *
* @return array * @return array
@ -43,10 +44,10 @@ final class Installer extends InstallerAbstract
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public static function installExternal(DatabasePool $dbPool, array $data) : array public static function installExternal(ApplicationAbstract $app, array $data) : array
{ {
try { try {
$dbPool->get()->con->query('select 1 from `nav`'); $app->dbPool->get()->con->query('select 1 from `nav`');
} catch (\Exception $e) { } catch (\Exception $e) {
return []; // @codeCoverageIgnore return []; // @codeCoverageIgnore
} }
@ -62,7 +63,7 @@ final class Installer extends InstallerAbstract
} }
foreach ($navData as $link) { foreach ($navData as $link) {
self::installLink($dbPool, $link); self::installLink($app->dbPool, $link);
} }
return []; return [];