Skip to content

Commit

Permalink
Maker: fix sublist generator 2le/crudit#437 (#464)
Browse files Browse the repository at this point in the history
* Maker: fix sublist generator 2le/crudit#437

* Update MakeCrudit.php
  • Loading branch information
valentin-helies authored Aug 28, 2024
1 parent fb83ad0 commit 3269db6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Maker/MakeCrudit.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private function getTabs(string $entityClass): array
$tabs['sublist'][] = [
'type' => 'sublist',
'label' => 'tab.' . strtolower($associationName),
'property' => strtolower($this->getBasename($entityClass)),
'property' => lcfirst($this->getBasename($entityClass)),
'linkedEntity' => $this->getBasename($metadata->getAssociationMapping($associationName)['targetEntity']),
];
}
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/skeleton/crud/config/CrudAutoConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
<?php if (array_key_exists('sublist', $tabs)) { ?>
<?php foreach ($tabs['sublist'] as $tab) { ?>
<?php if (!in_array($tab['linkedEntity'], $allLinkedEntity)) { ?>
protected <?= $tab['linkedEntity'] ?>CrudConfig $<?= strtolower($tab['linkedEntity']) ?>CrudConfig,
protected <?= $tab['linkedEntity'] ?>CrudConfig $<?= lcfirst($tab['linkedEntity']) ?>CrudConfig,
<?php $allLinkedEntity[] = $tab['linkedEntity'] ?>
<?php } ?>
<?php } ?>
Expand Down Expand Up @@ -111,8 +111,8 @@ public function getTabs(): array
{
return [
<?php foreach ($tabs['sublist'] as $tab) { ?>
'<?= $tab['label'] ?>' => [SublistConfig::new('<?= $tab['property'] ?>', $this-><?= strtolower($tab['linkedEntity']) ?>CrudConfig)
->setFields($this-><?= strtolower($tab['linkedEntity']) ?>CrudConfig->getFields(CrudConfigInterface::INDEX))],
'<?= $tab['label'] ?>' => [SublistConfig::new('<?= $tab['property'] ?>', $this-><?= lcfirst($tab['linkedEntity']) ?>CrudConfig)
->setFields($this-><?= lcfirst($tab['linkedEntity']) ?>CrudConfig->getFields(CrudConfigInterface::INDEX))],
<?php } ?>
<?php } ?>
<?php if (array_key_exists('history', $tabs)) { ?>
Expand Down

0 comments on commit 3269db6

Please sign in to comment.