composer require weew/app-doctrine
This package integrates doctrine/orm and doctrine/migrations into the weew/app framework.
Simply register the DoctrineProvider
class on the application kernel:
$app = new App();
$app->getKernel()->addProviders([
DoctrineProvider::class,
]);
This is how your config might look like in yaml:
doctrine:
debug: true
cache_path: path/to/cache
proxy_classes_path: path/to/proxies
metadata_format: "yaml" or "annotations"
# required if metadata_format is "annotations"
entities_paths:
path/to/entities: Namespace\To\Entities
# required if metadata_format is "yaml"
entities_mappings:
app:
path: path/to/entities
namespace: Some\Entities
bundle:
path: path/to/bundle/entities
namespace: Other\Entities
config:
driver: pdo_mysql
host: database_hostname
dbname: database_name
user: database_user
password: database_password
migrations:
namespace: migrations/namespace
path: migrations/directory/path
table: migrations_table_name
You can run doctrine console tool like this:
$doctrineProvider->runConsoleRunner();