Skip to content

Commit 52ca835

Browse files
authored
fix: remove columnPrefix (replaced by attributes) (#387)
1 parent 1febaf0 commit 52ca835

File tree

7 files changed

+3
-19
lines changed

7 files changed

+3
-19
lines changed

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ parameters:
1717
required: ?boolean,
1818
unique: boolean,
1919
embedded: boolean,
20-
columnPrefix: false|string,
2120
attributes: array<string, (int|bool|null|string|string[]|string[][]|\Nette\PhpGenerator\Literal)[]|null>
2221
}
2322
'''

src/AttributeGenerator/DoctrineOrmAttributeGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function generatePropertyAttributes(Property $property, string $className
178178
}
179179

180180
if ($property->isEmbedded) {
181-
return [new Attribute('ORM\Embedded', ['class' => $relationName, 'columnPrefix' => $property->columnPrefix])];
181+
return [new Attribute('ORM\Embedded', ['class' => $relationName])];
182182
}
183183

184184
$relationTableName = $this->generateIdentifierName($className.ucfirst($property->reference->name()).ucfirst($property->name()), 'join_table', $this->config);

src/Model/Property.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ abstract class Property
4141
public bool $isEmbedded = false;
4242
public ?string $mappedBy = null;
4343
public ?string $inversedBy = null;
44-
/** @var string|bool */
45-
public $columnPrefix = false;
4644
public bool $isId = false;
4745
public ?string $typeHint = null;
4846
public bool $isEnum = false;

src/Schema/PropertyGenerator/PropertyGenerator.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,6 @@ public function __invoke(string $name, array $config, Class_ $class, array $cont
145145
CardinalitiesExtractor::CARDINALITY_1_N,
146146
], true));
147147

148-
$columnPrefix = false;
149-
$isEmbedded = $propertyConfig['embedded'] ?? false;
150-
151-
if (true === $isEmbedded) {
152-
$columnPrefix = $propertyConfig['columnPrefix'] ?? false;
153-
}
154-
155148
$schemaProperty->resource = $typeProperty;
156149
$schemaProperty->range = $range;
157150
$schemaProperty->rangeName = $rangeName;
@@ -162,8 +155,7 @@ public function __invoke(string $name, array $config, Class_ $class, array $cont
162155
$schemaProperty->isNullable = $isNullable;
163156
$schemaProperty->isRequired = $propertyConfig['required'] ?? false;
164157
$schemaProperty->isUnique = $propertyConfig['unique'] ?? false;
165-
$schemaProperty->isEmbedded = $isEmbedded;
166-
$schemaProperty->columnPrefix = $columnPrefix;
158+
$schemaProperty->isEmbedded = $propertyConfig['embedded'] ?? false;
167159
$schemaProperty->mappedBy = $propertyConfig['mappedBy'] ?? null;
168160
$schemaProperty->inversedBy = $propertyConfig['inversedBy'] ?? null;
169161
$schemaProperty->groups = $propertyConfig['groups'] ?? [];

src/SchemaGeneratorConfiguration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ public function getConfigTreeBuilder(): TreeBuilder
245245
->booleanNode('required')->defaultTrue()->info('Is the property required?')->end()
246246
->booleanNode('unique')->defaultFalse()->info('The property unique')->end()
247247
->booleanNode('embedded')->defaultFalse()->info('Is the property embedded?')->end()
248-
->scalarNode('columnPrefix')->defaultFalse()->info('The property columnPrefix')->end()
249248
->append($attributesNode())
250249
->end()
251250
->end()

tests/AttributeGenerator/DoctrineOrmAttributeGeneratorTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ protected function setUp(): void
8282
$weightProperty->type = 'nonPositiveInteger';
8383
$vehicle->addProperty($weightProperty);
8484
$prefixedWeightProperty = new Property('prefixedWeight');
85-
$prefixedWeightProperty->columnPrefix = 'weight_';
8685
$prefixedWeightProperty->isEmbedded = true;
8786
$prefixedWeightProperty->rangeName = 'QuantitativeValue';
8887
$prefixedWeightProperty->range = new RdfResource('https://schema.org/QuantitativeValue');
@@ -204,7 +203,7 @@ public function testGeneratePropertyAttributes(): void
204203
$this->generator->generatePropertyAttributes($this->classMap['Vehicle']->getPropertyByName('weight'), 'Vehicle')
205204
);
206205
$this->assertEquals(
207-
[new Attribute('ORM\Embedded', ['class' => 'App\Entity\QuantitativeValue', 'columnPrefix' => 'weight_'])],
206+
[new Attribute('ORM\Embedded', ['class' => 'App\Entity\QuantitativeValue'])],
208207
$this->generator->generatePropertyAttributes($this->classMap['Vehicle']->getPropertyByName('prefixedWeight'), 'Vehicle')
209208
);
210209
$this->assertEquals(

tests/Command/DumpConfigurationTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ interface: null
249249
# Is the property embedded?
250250
embedded: false
251251
252-
# The property columnPrefix
253-
columnPrefix: false
254-
255252
# Attributes (merged with generated attributes)
256253
attributes: []
257254

0 commit comments

Comments
 (0)