Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator Template: Accept Properties #819

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Doctrine/Migrations/Generator/Generator.php
Expand Up @@ -39,6 +39,8 @@ class Generator
*/
final class Version<version> extends AbstractMigration
{
<properties>

public function getDescription() : string
{
return '';
Expand Down Expand Up @@ -73,20 +75,23 @@ public function __construct(Configuration $configuration)
public function generateMigration(
string $version,
?string $up = null,
?string $down = null
?string $down = null,
?string $properties = null
) : string {
$placeHolders = [
'<namespace>',
'<version>',
'<up>',
'<down>',
'<properties>',
];

$replacements = [
$this->configuration->getMigrationsNamespace(),
$version,
$up !== null ? ' ' . implode("\n ", explode("\n", $up)) : null,
$down !== null ? ' ' . implode("\n ", explode("\n", $down)) : null,
$properties !== null ? ' ' . implode("\n ", explode("\n", $properties)) : null,
];

$code = str_replace($placeHolders, $replacements, $this->getTemplate());
Expand Down