You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I'm not missing something in the documentation it is currently very cumbersome to have nested attributes as the nested attributes use the new keyword.
Therefore I would need to manually build a string like new SomeClassName('argument1', someOptionalParam: 'argument2') and then wrap it with Literal() to be able to generate nested attributes.
Instead it would be very helpful if the generator would recognise that there is an object as a parameter for the attribute and render it accordingly.
Example generator:
$file = new PhpFile();
$namespace = $file->addNamespace('App');
$class = $namespace->addClass('SomeEntity');
$tableAttributeParams = [
'name' => new Literal('self::TABLE_NAME'),
'indexes' => [],
];
$index = new ORM\Index();
$index->name = new Literal('self::INDEX_STATUS');
$index->columns = [new Literal('self::COLUMN_STATUS')];
$tableAttributeParams['indexes'][] = $index;
$printer = new PsrPrinter();
echo $printer->printFile($file);
If I'm not missing something in the documentation it is currently very cumbersome to have nested attributes as the nested attributes use the
new
keyword.Therefore I would need to manually build a string like
new SomeClassName('argument1', someOptionalParam: 'argument2')
and then wrap it withLiteral()
to be able to generate nested attributes.Instead it would be very helpful if the generator would recognise that there is an object as a parameter for the attribute and render it accordingly.
Example generator:
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: