Skip to content

Commit

Permalink
Merge pull request #6 from davefx/patch-1
Browse files Browse the repository at this point in the history
Escaping modelName for a valid PHP variable name
  • Loading branch information
Spea committed Feb 20, 2014
2 parents 7c352d2 + f0f16f8 commit 0156ead
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Sp/FixtureDumper/Generator/ClassFixtureGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ protected function generateLoadMethod(PhpClass $class, ClassMetadata $metadata,
$class->setMethod($method);

foreach ($data as $modelName => $modelData) {
$this->generateModel($modelName, $modelData, $metadata, $writer);
$search = array(' ', '-', 'á', 'é', 'í', 'ó', 'ú', 'ñ');
$replace = array('_', '_', 'a', 'e', 'i', 'o', 'u', 'n');
$withoutSpace = str_replace($search, $replace, $modelName);
$this->generateModel($withoutSpace, $modelData, $metadata, $writer);
$writer->writeln("");
}

Expand Down

0 comments on commit 0156ead

Please sign in to comment.