Skip to content

Commit

Permalink
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/gql/mutations/Entry.php
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public static function getMutations(): array
$canSave = Gql::canSchema($scope, 'save');

if ($canCreate || $canSave) {
// Create a mutation for each editable section that includes the entry type
// Create a mutation for each entry type
foreach ($section->getEntryTypes() as $entryType) {
foreach (static::createSaveMutations($section, $entryType, $canSave) as $mutation) {
$mutationList[$mutation['name']] = $mutation;
2 changes: 1 addition & 1 deletion src/gql/queries/Entry.php
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ protected static function getSectionLevelFields(): array
$sectionQueryType = [
'name' => "{$section->handle}Entries",
'args' => $arguments,
'description' => "Entries within the $section->name section.",
'description' => sprintf('Entries within the “%s” section.', $section->name),
'type' => Type::listOf(GqlHelper::getUnionType("{$section->handle}SectionEntryUnion", $entryTypesInSection)),
// Enforce the section argument and set the source to `null`, to enforce a new element query.
'resolve' => fn($source, array $arguments, $context, ResolveInfo $resolveInfo) =>
2 changes: 0 additions & 2 deletions src/gql/resolvers/elements/Entry.php
Original file line number Diff line number Diff line change
@@ -31,8 +31,6 @@ public static function prepareQuery(mixed $source, array $arguments, ?string $fi
// If this is the beginning of a resolver chain, start fresh
if ($source === null) {
$query = EntryElement::find();


$pairs = GqlHelper::extractAllowedEntitiesFromSchema('read');

if (!isset($pairs['sections'])) {
12 changes: 4 additions & 8 deletions src/helpers/Gql.php
Original file line number Diff line number Diff line change
@@ -576,13 +576,9 @@ public static function getSchemaContainedEntryTypes(?GqlSchema $schema = null):
{
$entryTypes = [];

foreach (Craft::$app->getEntries()->getAllSections() as $section) {
if (self::isSchemaAwareOf("sections.$section->uid", $schema)) {
foreach ($section->getEntryTypes() as $entryType) {
if (!isset($entryTypes[$entryType->uid])) {
$entryTypes[$entryType->uid] = $entryType;
}
}
foreach (static::getSchemaContainedSections($schema) as $section) {
foreach ($section->getEntryTypes() as $entryType) {
$entryTypes[$entryType->uid] = $entryType;
}
}

@@ -599,7 +595,7 @@ public static function getSchemaContainedSections(?GqlSchema $schema = null): ar
{
return array_filter(
Craft::$app->getEntries()->getAllSections(),
fn(Section $section) => self::isSchemaAwareOf("sections.$section->uid", $schema),
fn(Section $section) => static::isSchemaAwareOf("sections.$section->uid", $schema),
);
}

0 comments on commit a3419ea

Please sign in to comment.