From 9ac51628bbe3398bf3edeada193522dbbcf1b23e Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Thu, 18 Nov 2021 13:50:27 +0300 Subject: [PATCH] Add typecast rendering; add `inversion` and `order_by` in php renderer --- src/OutputSchemaRenderer.php | 11 +++++++---- src/PhpFileRenderer/Item/RelationBlock.php | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/OutputSchemaRenderer.php b/src/OutputSchemaRenderer.php index c7dee8c..556abcd 100644 --- a/src/OutputSchemaRenderer.php +++ b/src/OutputSchemaRenderer.php @@ -56,7 +56,7 @@ public function __construct(int $format = self::FORMAT_CONSOLE_COLOR) // JTI support if (isset($constants['PARENT'], $constants['PARENT_KEY'])) { $this->addRenderer(...[ - new PropertyRenderer($constants['PARENT'], 'CHILDREN'), + new PropertyRenderer($constants['PARENT'], 'Children'), new KeysRenderer($constants['PARENT_KEY'], 'STI key', false), ]); } @@ -69,12 +69,15 @@ public function __construct(int $format = self::FORMAT_CONSOLE_COLOR) ]); } - $this->addRenderer(...[ - new ColumnsRenderer(), + $this->addRenderer(new ColumnsRenderer()); + if (isset($constants['TYPECAST_HANDLER'])) { + $this->addRenderer(new PropertyRenderer($constants['TYPECAST_HANDLER'], 'Typecast')); + } + $this->addRenderer( new RelationsRenderer(), new CustomPropertiesRenderer(array_values($constants)), new MacrosRenderer(), - ]); + ); } /** diff --git a/src/PhpFileRenderer/Item/RelationBlock.php b/src/PhpFileRenderer/Item/RelationBlock.php index fbd6306..21034d7 100644 --- a/src/PhpFileRenderer/Item/RelationBlock.php +++ b/src/PhpFileRenderer/Item/RelationBlock.php @@ -10,13 +10,18 @@ class RelationBlock extends ArrayBlock { + /** + * @see SchemaInterface + */ private const RELATION_SCHEMA_KEYS = [ 'MORPH_KEY', 'CASCADE', 'NULLABLE', 'OUTER_KEY', 'INNER_KEY', + 'INVERSION', 'WHERE', + 'ORDER_BY', 'THROUGH_INNER_KEY', 'THROUGH_OUTER_KEY', 'THROUGH_ENTITY',