Loading Module.php +0 −7 Changes for Module.php: 0 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -9,13 +9,6 @@ use Laminas\Mvc\MvcEvent; */ class Module { public function onBootstrap(MvcEvent $e) { } public function getConfig() { return include __DIR__ . '/config/module.config.php'; Loading config/module.config.php +58 −1 Changes for config/module.config.php: 58 added lines, 1 removed line. Original line number Diff line number Diff line <?php return []; No newline at end of file namespace Unicaen\BddAdmin; return [ 'unicaen-bddadmin' => [ 'connection' => [ 'default' => [ 'driver' => 'Postgresql', // par défaut, ou Oracle ou Mysql 'host' => '', 'port' => '', 'dbname' => '', 'user' => '', 'password' => '', ], // Autres instances de la BDD ], 'ddl' => [ 'dir' => 'data/ddl', 'columns_positions_file' => 'data/ddl_columns_pos.php', ], 'data' => [ 'sources' => [], 'actions' => [], 'config' => [], // configuration par tables ], 'migration' => [ 'dir' => 'Application/src/Migration', ], 'id_column' => 'id', 'histo' => [ 'user_id' => null, 'histo_creation_column' => 'histo_creation', 'histo_modification_column' => 'histo_modification', 'histo_destruction_column' => 'histo_destruction', 'histo_createur_id_column' => 'histo_createur_id', 'histo_modificateur_id_column' => 'histo_modificateur_id', 'histo_destructeur_id_column' => 'histo_destructeur_id', ], 'import' => [ 'source_id' => null, 'source_id_column' => 'source_id', 'source_code_column' => 'source_code', ], ], 'service_manager' => [ 'factories' => [ Bdd::class => BddFactory::class, ], ], ]; No newline at end of file doc/options.md +0 −5 Changes for doc/options.md: 0 added lines, 5 removed lines. Original line number Diff line number Diff line # Options - hasOption - getOption - setOption - getOptions - setOptions No newline at end of file src/Bdd.php +126 −133 Changes for src/Bdd.php: 126 added lines, 133 removed lines. Original line number Diff line number Diff line Loading @@ -2,14 +2,13 @@ namespace Unicaen\BddAdmin; use Unicaen\BddAdmin\Data\DataManager; use Unicaen\BddAdmin\Ddl\Ddl; use Unicaen\BddAdmin\Ddl\DdlDiff; use Unicaen\BddAdmin\Ddl\DdlFilters; use Unicaen\BddAdmin\Driver\DriverInterface; use Unicaen\BddAdmin\Event\EventManagerAwareTrait; use Unicaen\BddAdmin\Exception\BddCompileException; use Unicaen\BddAdmin\Exception\BddException; use Unicaen\BddAdmin\Exception\BddIndexExistsException; use Unicaen\BddAdmin\Logger\DefaultLogger; use Unicaen\BddAdmin\Logger\LoggerAwareTrait; use Unicaen\BddAdmin\Manager\CompilableInterface; Loading @@ -30,15 +29,33 @@ use Unicaen\BddAdmin\Manager\ViewManagerInterface; use \Exception; use Unicaen\BddAdmin\Manager\VoidManager; use Unicaen\BddAdmin\Migration\MigrationManager; use Unicaen\BddAdmin\Trait\OptionsTrait; class Bdd { use EventManagerAwareTrait; use LoggerAwareTrait; const OPTION_DDL_DIR = 'ddl_dir'; const OPTION_MIGRATION_DIR = 'migration_dir'; const OPTION_COLUMNS_POSITIONS_FILE = 'columns_positions_file'; use OptionsTrait; const CONNECTION_DEFAULT = 'default'; const OPTION_CONNECTION = 'connection'; const OPTION_DDL = 'ddl'; const OPTION_DATA = 'data'; const OPTION_MIGRATION = 'migration'; const OPTION_ID_COLUMN = 'id_column'; const OPTION_HISTO = 'histo'; const OPTION_HISTO_USER_ID = 'histo/user_id'; const OPTION_HISTO_CREATION_COLUMN = 'histo/histo_creation_column'; const OPTION_HISTO_MODIFICATION_COLUMN = 'histo/histo_modification_column'; const OPTION_HISTO_DESTRUCTION_COLUMN = 'histo/histo_destruction_column'; const OPTION_HISTO_CREATEUR_ID_COLUMN = 'histo/histo_createur_id_column'; const OPTION_HISTO_MODIFICATEUR_ID_COLUMN = 'histo/histo_modificateur_id_column'; const OPTION_HISTO_DESTRUCTEUR_ID_COLUMN = 'histo/histo_destructeur_id_column'; const OPTION_IMPORT = 'import'; const OPTION_IMPORT_SOURCE_ID = 'import/source_id'; const OPTION_IMPORT_SOURCE_ID_COLUMN = 'import/source_id_column'; const OPTION_IMPORT_SOURCE_CODE_COLUMN = 'import/source_code_column'; const FETCH_ALL = 32; const FETCH_EACH = 16; Loading Loading @@ -106,9 +123,12 @@ class Bdd Ddl::SCHEMA . '.drop' => 'Suppression des schémas', ]; private array $config; private string $connection = self::CONNECTION_DEFAULT; private array $options = []; /** @var array|Bdd[] */ private array $bdds = []; private array $config; private ?DriverInterface $driver = null; Loading @@ -125,19 +145,21 @@ class Bdd protected bool $inCopy = false; private DataUpdater $dataUpdater; private DataManager $data; /** * Bdd constructor. * * @param array $config */ public function __construct(array $config = []) public function __construct(array $options = [], string $connection = self::CONNECTION_DEFAULT) { if (!empty($config)) { $this->setConfig($config); $this->connection = $connection; if (!empty($options)) { // Compatibilité avec l'ancienne configuration des connections if (!isset($options[self::OPTION_CONNECTION]) && isset($options['host'])) { $options = [self::OPTION_CONNECTION => [$connection => $options]]; } $this->setOptions($options); $this->connect(); } // On positionne un logger par défaut si on est en mode console, sinon non Loading @@ -148,9 +170,62 @@ class Bdd /** * @return self */ public function hasConnection(string $connection): bool { $connections = $this->options[self::OPTION_CONNECTION]; return array_key_exists($connection, $connections); } public function getBdd(string $connection): self { if (!array_key_exists($connection, $this->bdds)) { if ($this->hasConnection($connection)) { $this->bdds[$connection] = new self($this->getOptions(), $connection); } else { throw new \Exception('La connexion "' . $connection . '" n\'est pas présente en config, rubrique unicaen-bddadmin/'.self::OPTION_CONNECTION); } } return $this->bdds[$connection]; } public function getHistoUserId(): ?int { return $this->getOption(self::OPTION_HISTO_USER_ID); } public function setHistoUserId(int $histoUserId): self { $this->setOption(self::OPTION_HISTO_USER_ID, $histoUserId); return $this; } public function getSourceId(): ?int { return $this->getOption(self::OPTION_IMPORT_SOURCE_ID); } public function setSourceId(int $sourceOseId): self { $this->setOption(self::OPTION_IMPORT_SOURCE_ID, $sourceOseId); return $this; } public function beginTransaction(): self { $this->driver->beginTransaction(); Loading @@ -160,12 +235,6 @@ class Bdd /** * @return $this * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function commitTransaction(): self { $this->driver->commitTransaction(); Loading @@ -175,9 +244,6 @@ class Bdd /** * @return $this */ public function rollbackTransaction(): self { $this->driver->rollbackTransaction(); Loading @@ -187,59 +253,48 @@ class Bdd /** * @param string $sql * @param array $params * * @return bool * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function exec(string $sql, array $params = [], array $types = []) public function exec(string $sql, array $params = [], array $types = []): self { $this->driver->exec($sql, $params, $types); return true; return $this; } public function queryCollect(string $sql, string $description = null) public function queryCollect(string $sql, string $description = null): self { if ($this->queryCollect) { $this->queries[$sql] = $description; } else { $this->exec($sql); } return $this; } /** * @param string $sql * @param array $params * @param array $options * * @return array|null|SelectParser * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function select(string $sql, array $params = [], array $options = []) public function select(string $sql, array $params = [], array $options = []): array|null|SelectParser { return $this->driver->select($sql, $params, $options); } public function selectOne(string $sql, array $params = [], string $column = null): mixed public function selectOne(string $sql, array $params = [], string $column = null, array $options = []): mixed { $res = $this->select($sql, $params, ['fetch' => self::FETCH_ONE]); $options['fetch'] = self::FETCH_ONE; $res = $this->select($sql, $params, $options); if (empty($res)) return null; if (is_array($res) && !empty($column)) { if (!isset($res[$column])){ $column = strtolower($column); $res = array_change_key_case($res, CASE_LOWER); } return $res[$column]; } Loading @@ -248,9 +303,10 @@ class Bdd public function selectEach(string $sql, array $params = []): SelectParser public function selectEach(string $sql, array $params = [], array $options = []): SelectParser { return $this->select($sql, $params, ['fetch' => self::FETCH_EACH]); $options['fetch'] = self::FETCH_EACH; return $this->select($sql, $params, $options); } Loading @@ -271,23 +327,18 @@ class Bdd public function getConfig(): array { return $this->config; } public function setConfig(array $config): self public function connect(): self { $this->config = $config; if ($this->driver) { $this->driver->disconnect(); } $driverClass = isset($config['driver']) ? $config['driver'] : 'Oracle'; $connectionOptions = $this->getOption(self::OPTION_CONNECTION . '/' . $this->connection, []); $driverClass = isset($connectionOptions['driver']) ? $connectionOptions['driver'] : 'Postgresql'; $driverClass = "Unicaen\BddAdmin\Driver\\$driverClass\Driver"; $this->driver = new $driverClass($this); $this->driver->connect(); $this->driver->connect($connectionOptions); return $this; } Loading Loading @@ -332,61 +383,14 @@ class Bdd public function hasOption(string $name): bool public function data(): DataManager { return array_key_exists($name, $this->options); if (!isset($this->data)) { $this->data = new DataManager($this); $this->data->setOptions($this->getOption(self::OPTION_DATA, [])); } public function getOption(string $name): mixed { if ($this->hasOption($name)) { return $this->options[$name]; } else { return null; } } public function setOption(string $name, mixed $value): self { $this->options[$name] = $value; return $this; } public function getOptions(): array { return $this->options; } public function setOptions(array $options, bool $clearOthers = false): self { if ($clearOthers) { $this->options = []; } foreach ($options as $name => $option) { $this->setOption($name, $option); } return $this; } public function dataUpdater(): DataUpdater { if (!isset($this->dataUpdater)) { $this->dataUpdater = new DataUpdater($this); } return $this->dataUpdater; return $this->data; } Loading @@ -395,6 +399,7 @@ class Bdd { if (!isset($this->migration)) { $this->migration = new MigrationManager($this); $this->migration->setOptions($this->getOption(self::OPTION_MIGRATION, [])); } return $this->migration; Loading Loading @@ -498,8 +503,7 @@ class Bdd $this->logBegin("Récupération de la DDL"); $filters = DdlFilters::normalize($filters); $ddl = new Ddl(); $ddl->setDir($this->getOption(self::OPTION_DDL_DIR)); $ddl->setColumnsPosFile($this->getOption(self::OPTION_COLUMNS_POSITIONS_FILE)); $ddl->setOptions($this->getOption(self::OPTION_DDL, [])); $managers = $this->managerList(); foreach ($managers as $type => $libelle) { if (!($filters->isExplicit() && $filters->get($type)->isEmpty())) { Loading @@ -519,13 +523,8 @@ class Bdd public function getRefDdl(): Ddl { $ddlDir = $this->getOption(self::OPTION_DDL_DIR); if (!is_dir($ddlDir)){ throw new \Exception('Erreur sur le répertoire de DDL au niveau du projet'); } $ddl = new Ddl(); $ddl->setDir($ddlDir); $ddl->setOptions($this->getOption(self::OPTION_DDL, [])); $ddl->loadFromDir(); return $ddl; Loading Loading @@ -847,12 +846,6 @@ class Bdd /** * @return array * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function compilerTout(): array { $this->logBegin("Compilation de tous les objets de la BDD"); Loading src/BddFactory.php 0 → 100644 +30 −0 Changes for src/BddFactory.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Unicaen\BddAdmin; use Psr\Container\ContainerInterface; /** * Description of BddFactory * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class BddFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return Bdd */ public function __invoke(ContainerInterface $container, $requestedName, $options = null): Bdd { $config = $container->get('config')['unicaen-bddadmin']; $bdd = new Bdd($config); return $bdd; } } No newline at end of file Loading
Module.php +0 −7 Changes for Module.php: 0 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -9,13 +9,6 @@ use Laminas\Mvc\MvcEvent; */ class Module { public function onBootstrap(MvcEvent $e) { } public function getConfig() { return include __DIR__ . '/config/module.config.php'; Loading
config/module.config.php +58 −1 Changes for config/module.config.php: 58 added lines, 1 removed line. Original line number Diff line number Diff line <?php return []; No newline at end of file namespace Unicaen\BddAdmin; return [ 'unicaen-bddadmin' => [ 'connection' => [ 'default' => [ 'driver' => 'Postgresql', // par défaut, ou Oracle ou Mysql 'host' => '', 'port' => '', 'dbname' => '', 'user' => '', 'password' => '', ], // Autres instances de la BDD ], 'ddl' => [ 'dir' => 'data/ddl', 'columns_positions_file' => 'data/ddl_columns_pos.php', ], 'data' => [ 'sources' => [], 'actions' => [], 'config' => [], // configuration par tables ], 'migration' => [ 'dir' => 'Application/src/Migration', ], 'id_column' => 'id', 'histo' => [ 'user_id' => null, 'histo_creation_column' => 'histo_creation', 'histo_modification_column' => 'histo_modification', 'histo_destruction_column' => 'histo_destruction', 'histo_createur_id_column' => 'histo_createur_id', 'histo_modificateur_id_column' => 'histo_modificateur_id', 'histo_destructeur_id_column' => 'histo_destructeur_id', ], 'import' => [ 'source_id' => null, 'source_id_column' => 'source_id', 'source_code_column' => 'source_code', ], ], 'service_manager' => [ 'factories' => [ Bdd::class => BddFactory::class, ], ], ]; No newline at end of file
doc/options.md +0 −5 Changes for doc/options.md: 0 added lines, 5 removed lines. Original line number Diff line number Diff line # Options - hasOption - getOption - setOption - getOptions - setOptions No newline at end of file
src/Bdd.php +126 −133 Changes for src/Bdd.php: 126 added lines, 133 removed lines. Original line number Diff line number Diff line Loading @@ -2,14 +2,13 @@ namespace Unicaen\BddAdmin; use Unicaen\BddAdmin\Data\DataManager; use Unicaen\BddAdmin\Ddl\Ddl; use Unicaen\BddAdmin\Ddl\DdlDiff; use Unicaen\BddAdmin\Ddl\DdlFilters; use Unicaen\BddAdmin\Driver\DriverInterface; use Unicaen\BddAdmin\Event\EventManagerAwareTrait; use Unicaen\BddAdmin\Exception\BddCompileException; use Unicaen\BddAdmin\Exception\BddException; use Unicaen\BddAdmin\Exception\BddIndexExistsException; use Unicaen\BddAdmin\Logger\DefaultLogger; use Unicaen\BddAdmin\Logger\LoggerAwareTrait; use Unicaen\BddAdmin\Manager\CompilableInterface; Loading @@ -30,15 +29,33 @@ use Unicaen\BddAdmin\Manager\ViewManagerInterface; use \Exception; use Unicaen\BddAdmin\Manager\VoidManager; use Unicaen\BddAdmin\Migration\MigrationManager; use Unicaen\BddAdmin\Trait\OptionsTrait; class Bdd { use EventManagerAwareTrait; use LoggerAwareTrait; const OPTION_DDL_DIR = 'ddl_dir'; const OPTION_MIGRATION_DIR = 'migration_dir'; const OPTION_COLUMNS_POSITIONS_FILE = 'columns_positions_file'; use OptionsTrait; const CONNECTION_DEFAULT = 'default'; const OPTION_CONNECTION = 'connection'; const OPTION_DDL = 'ddl'; const OPTION_DATA = 'data'; const OPTION_MIGRATION = 'migration'; const OPTION_ID_COLUMN = 'id_column'; const OPTION_HISTO = 'histo'; const OPTION_HISTO_USER_ID = 'histo/user_id'; const OPTION_HISTO_CREATION_COLUMN = 'histo/histo_creation_column'; const OPTION_HISTO_MODIFICATION_COLUMN = 'histo/histo_modification_column'; const OPTION_HISTO_DESTRUCTION_COLUMN = 'histo/histo_destruction_column'; const OPTION_HISTO_CREATEUR_ID_COLUMN = 'histo/histo_createur_id_column'; const OPTION_HISTO_MODIFICATEUR_ID_COLUMN = 'histo/histo_modificateur_id_column'; const OPTION_HISTO_DESTRUCTEUR_ID_COLUMN = 'histo/histo_destructeur_id_column'; const OPTION_IMPORT = 'import'; const OPTION_IMPORT_SOURCE_ID = 'import/source_id'; const OPTION_IMPORT_SOURCE_ID_COLUMN = 'import/source_id_column'; const OPTION_IMPORT_SOURCE_CODE_COLUMN = 'import/source_code_column'; const FETCH_ALL = 32; const FETCH_EACH = 16; Loading Loading @@ -106,9 +123,12 @@ class Bdd Ddl::SCHEMA . '.drop' => 'Suppression des schémas', ]; private array $config; private string $connection = self::CONNECTION_DEFAULT; private array $options = []; /** @var array|Bdd[] */ private array $bdds = []; private array $config; private ?DriverInterface $driver = null; Loading @@ -125,19 +145,21 @@ class Bdd protected bool $inCopy = false; private DataUpdater $dataUpdater; private DataManager $data; /** * Bdd constructor. * * @param array $config */ public function __construct(array $config = []) public function __construct(array $options = [], string $connection = self::CONNECTION_DEFAULT) { if (!empty($config)) { $this->setConfig($config); $this->connection = $connection; if (!empty($options)) { // Compatibilité avec l'ancienne configuration des connections if (!isset($options[self::OPTION_CONNECTION]) && isset($options['host'])) { $options = [self::OPTION_CONNECTION => [$connection => $options]]; } $this->setOptions($options); $this->connect(); } // On positionne un logger par défaut si on est en mode console, sinon non Loading @@ -148,9 +170,62 @@ class Bdd /** * @return self */ public function hasConnection(string $connection): bool { $connections = $this->options[self::OPTION_CONNECTION]; return array_key_exists($connection, $connections); } public function getBdd(string $connection): self { if (!array_key_exists($connection, $this->bdds)) { if ($this->hasConnection($connection)) { $this->bdds[$connection] = new self($this->getOptions(), $connection); } else { throw new \Exception('La connexion "' . $connection . '" n\'est pas présente en config, rubrique unicaen-bddadmin/'.self::OPTION_CONNECTION); } } return $this->bdds[$connection]; } public function getHistoUserId(): ?int { return $this->getOption(self::OPTION_HISTO_USER_ID); } public function setHistoUserId(int $histoUserId): self { $this->setOption(self::OPTION_HISTO_USER_ID, $histoUserId); return $this; } public function getSourceId(): ?int { return $this->getOption(self::OPTION_IMPORT_SOURCE_ID); } public function setSourceId(int $sourceOseId): self { $this->setOption(self::OPTION_IMPORT_SOURCE_ID, $sourceOseId); return $this; } public function beginTransaction(): self { $this->driver->beginTransaction(); Loading @@ -160,12 +235,6 @@ class Bdd /** * @return $this * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function commitTransaction(): self { $this->driver->commitTransaction(); Loading @@ -175,9 +244,6 @@ class Bdd /** * @return $this */ public function rollbackTransaction(): self { $this->driver->rollbackTransaction(); Loading @@ -187,59 +253,48 @@ class Bdd /** * @param string $sql * @param array $params * * @return bool * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function exec(string $sql, array $params = [], array $types = []) public function exec(string $sql, array $params = [], array $types = []): self { $this->driver->exec($sql, $params, $types); return true; return $this; } public function queryCollect(string $sql, string $description = null) public function queryCollect(string $sql, string $description = null): self { if ($this->queryCollect) { $this->queries[$sql] = $description; } else { $this->exec($sql); } return $this; } /** * @param string $sql * @param array $params * @param array $options * * @return array|null|SelectParser * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function select(string $sql, array $params = [], array $options = []) public function select(string $sql, array $params = [], array $options = []): array|null|SelectParser { return $this->driver->select($sql, $params, $options); } public function selectOne(string $sql, array $params = [], string $column = null): mixed public function selectOne(string $sql, array $params = [], string $column = null, array $options = []): mixed { $res = $this->select($sql, $params, ['fetch' => self::FETCH_ONE]); $options['fetch'] = self::FETCH_ONE; $res = $this->select($sql, $params, $options); if (empty($res)) return null; if (is_array($res) && !empty($column)) { if (!isset($res[$column])){ $column = strtolower($column); $res = array_change_key_case($res, CASE_LOWER); } return $res[$column]; } Loading @@ -248,9 +303,10 @@ class Bdd public function selectEach(string $sql, array $params = []): SelectParser public function selectEach(string $sql, array $params = [], array $options = []): SelectParser { return $this->select($sql, $params, ['fetch' => self::FETCH_EACH]); $options['fetch'] = self::FETCH_EACH; return $this->select($sql, $params, $options); } Loading @@ -271,23 +327,18 @@ class Bdd public function getConfig(): array { return $this->config; } public function setConfig(array $config): self public function connect(): self { $this->config = $config; if ($this->driver) { $this->driver->disconnect(); } $driverClass = isset($config['driver']) ? $config['driver'] : 'Oracle'; $connectionOptions = $this->getOption(self::OPTION_CONNECTION . '/' . $this->connection, []); $driverClass = isset($connectionOptions['driver']) ? $connectionOptions['driver'] : 'Postgresql'; $driverClass = "Unicaen\BddAdmin\Driver\\$driverClass\Driver"; $this->driver = new $driverClass($this); $this->driver->connect(); $this->driver->connect($connectionOptions); return $this; } Loading Loading @@ -332,61 +383,14 @@ class Bdd public function hasOption(string $name): bool public function data(): DataManager { return array_key_exists($name, $this->options); if (!isset($this->data)) { $this->data = new DataManager($this); $this->data->setOptions($this->getOption(self::OPTION_DATA, [])); } public function getOption(string $name): mixed { if ($this->hasOption($name)) { return $this->options[$name]; } else { return null; } } public function setOption(string $name, mixed $value): self { $this->options[$name] = $value; return $this; } public function getOptions(): array { return $this->options; } public function setOptions(array $options, bool $clearOthers = false): self { if ($clearOthers) { $this->options = []; } foreach ($options as $name => $option) { $this->setOption($name, $option); } return $this; } public function dataUpdater(): DataUpdater { if (!isset($this->dataUpdater)) { $this->dataUpdater = new DataUpdater($this); } return $this->dataUpdater; return $this->data; } Loading @@ -395,6 +399,7 @@ class Bdd { if (!isset($this->migration)) { $this->migration = new MigrationManager($this); $this->migration->setOptions($this->getOption(self::OPTION_MIGRATION, [])); } return $this->migration; Loading Loading @@ -498,8 +503,7 @@ class Bdd $this->logBegin("Récupération de la DDL"); $filters = DdlFilters::normalize($filters); $ddl = new Ddl(); $ddl->setDir($this->getOption(self::OPTION_DDL_DIR)); $ddl->setColumnsPosFile($this->getOption(self::OPTION_COLUMNS_POSITIONS_FILE)); $ddl->setOptions($this->getOption(self::OPTION_DDL, [])); $managers = $this->managerList(); foreach ($managers as $type => $libelle) { if (!($filters->isExplicit() && $filters->get($type)->isEmpty())) { Loading @@ -519,13 +523,8 @@ class Bdd public function getRefDdl(): Ddl { $ddlDir = $this->getOption(self::OPTION_DDL_DIR); if (!is_dir($ddlDir)){ throw new \Exception('Erreur sur le répertoire de DDL au niveau du projet'); } $ddl = new Ddl(); $ddl->setDir($ddlDir); $ddl->setOptions($this->getOption(self::OPTION_DDL, [])); $ddl->loadFromDir(); return $ddl; Loading Loading @@ -847,12 +846,6 @@ class Bdd /** * @return array * @throws BddCompileException * @throws BddException * @throws BddIndexExistsException */ public function compilerTout(): array { $this->logBegin("Compilation de tous les objets de la BDD"); Loading
src/BddFactory.php 0 → 100644 +30 −0 Changes for src/BddFactory.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Unicaen\BddAdmin; use Psr\Container\ContainerInterface; /** * Description of BddFactory * * @author Laurent Lécluse <laurent.lecluse at unicaen.fr> */ class BddFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return Bdd */ public function __invoke(ContainerInterface $container, $requestedName, $options = null): Bdd { $config = $container->get('config')['unicaen-bddadmin']; $bdd = new Bdd($config); return $bdd; } } No newline at end of file