classXmlAttribute
final class XmlAttribute
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.A value of XMLATTRIBUTES or XMLFOREST, optionally named with AS.
Mirrors the ResTarget the grammar builds for xml_attribute_el. An unnamed value takes the name of the column it references. Source: https://www.postgresql.org/docs/17/functions-xml.html#FUNCTIONS-PRODUCING-XML-XMLELEMENT.
$attribute = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlAttribute(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral(), new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('id'));
$attribute->name->value // => 'id'Properties§
public Scalar $valuepublic Name|null $name = nullMethods§
public function __construct(public Scalar $value, public Name|null $name = null)Parameters
$value | Scalar | The value |
$name | Name|null | The name written after AS |
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the value.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Calls 1
- method-call Derivation::scalar() line 45
public function render(Output $out): voidWrites the value and the name.
Parameters
$out | Output |
Test cases 1
Calls 3
- method-call Output::node() line 53
- method-call Output::keyword() line 55
- class-const NameUse::Label() line 55
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 7
XmlChecksTest::testAttributesReportsUnnamedValuesAndRepeatedNamescallsXmlChecksTest::testElementsReportsUnnamedValuescallsXmlElementTest::testDeriveScalarReportsAnUnnamedAttributecallsXmlElementTest::testRenderWritesAttributesAndContentcallsXmlForestTest::testDeriveScalarReportsAnUnnamedValuecallsXmlForestTest::testOutputNameIsXmlforestcallsXmlForestTest::testRenderWritesTheValuescalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\XmlRule::attributes() packages/sql-semantics-postgres/src/Lowering/Invocation/XmlRule.php:192
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\XmlRule::attributes() packages/sql-semantics-postgres/src/Lowering/Invocation/XmlRule.php:193
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlElement::__construct() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlElement.php:57
- class-const SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlForest::__construct() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlForest.php:49