Skip to content

Conversation

epi-ADN
Copy link

@epi-ADN epi-ADN commented Mar 19, 2024

Not sure if the select methods for fields belonging to the interface class should be repeated in the possible types.

Example of a parent class generated from an INTERFACE object :

<?php namespace GraphQL\SchemaObject; class ChampQueryObject extends UnionObject { const OBJECT_NAME = "Champ"; public function selectId() { $this->selectField("id"); return $this; } public function selectLabel() { $this->selectField("label"); return $this; } public function selectStringValue() { $this->selectField("stringValue"); return $this; } public function onAddressChamp() { $object = new AddressChampQueryObject(); $this->addPossibleType($object); return $object; } public function onCarteChamp() { $object = new CarteChampQueryObject(); $this->addPossibleType($object); return $object; } public function onCheckboxChamp() { $object = new CheckboxChampQueryObject(); $this->addPossibleType($object); return $object; } public function onCiviliteChamp() { $object = new CiviliteChampQueryObject(); $this->addPossibleType($object); return $object; } public function onCommuneChamp() { $object = new CommuneChampQueryObject(); $this->addPossibleType($object); return $object; } public function onDateChamp() { $object = new DateChampQueryObject(); $this->addPossibleType($object); return $object; } public function onDatetimeChamp() { $object = new DatetimeChampQueryObject(); $this->addPossibleType($object); return $object; } public function onDecimalNumberChamp() { $object = new DecimalNumberChampQueryObject(); $this->addPossibleType($object); return $object; } public function onDepartementChamp() { $object = new DepartementChampQueryObject(); $this->addPossibleType($object); return $object; } public function onDossierLinkChamp() { $object = new DossierLinkChampQueryObject(); $this->addPossibleType($object); return $object; } public function onEpciChamp() { $object = new EpciChampQueryObject(); $this->addPossibleType($object); return $object; } public function onIntegerNumberChamp() { $object = new IntegerNumberChampQueryObject(); $this->addPossibleType($object); return $object; } public function onLinkedDropDownListChamp() { $object = new LinkedDropDownListChampQueryObject(); $this->addPossibleType($object); return $object; } public function onMultipleDropDownListChamp() { $object = new MultipleDropDownListChampQueryObject(); $this->addPossibleType($object); return $object; } public function onPaysChamp() { $object = new PaysChampQueryObject(); $this->addPossibleType($object); return $object; } public function onPieceJustificativeChamp() { $object = new PieceJustificativeChampQueryObject(); $this->addPossibleType($object); return $object; } public function onRegionChamp() { $object = new RegionChampQueryObject(); $this->addPossibleType($object); return $object; } public function onRepetitionChamp() { $object = new RepetitionChampQueryObject(); $this->addPossibleType($object); return $object; } public function onSiretChamp() { $object = new SiretChampQueryObject(); $this->addPossibleType($object); return $object; } public function onTextChamp() { $object = new TextChampQueryObject(); $this->addPossibleType($object); return $object; } public function onTitreIdentiteChamp() { $object = new TitreIdentiteChampQueryObject(); $this->addPossibleType($object); return $object; } } 

Example of one of the possible type "AddressChamp" :

<?php namespace GraphQL\SchemaObject; class AddressChampQueryObject extends QueryObject { const OBJECT_NAME = "AddressChamp"; public function selectAddress(AddressChampAddressArgumentsObject $argsObject = null) { $object = new AddressQueryObject("address"); if ($argsObject !== null) { $object->appendArguments($argsObject->toArray()); } $this->selectField($object); return $object; } public function selectCommune(AddressChampCommuneArgumentsObject $argsObject = null) { $object = new CommuneQueryObject("commune"); if ($argsObject !== null) { $object->appendArguments($argsObject->toArray()); } $this->selectField($object); return $object; } public function selectDepartement(AddressChampDepartementArgumentsObject $argsObject = null) { $object = new DepartementQueryObject("departement"); if ($argsObject !== null) { $object->appendArguments($argsObject->toArray()); } $this->selectField($object); return $object; } public function selectId() { $this->selectField("id"); return $this; } public function selectLabel() { $this->selectField("label"); return $this; } public function selectStringValue() { $this->selectField("stringValue"); return $this; } } 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant