Source of file PublicationNoticeType.php
Size: 1,780 Bytes - Last Modified: 2021-12-23T10:27:34+00:00
/var/www/docs.ssmods.com/process/src/_legacy/GraphQL/PublicationNoticeType.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | <?php namespace SilverStripe\AssetAdmin\GraphQL; use GraphQL\Type\Definition\Type; use SilverStripe\GraphQL\TypeCreator; use GraphQL\Type\Definition\ResolveInfo; use Exception; if (!class_exists(TypeCreator::class)) { return; } /** * @deprecated 4.8..5.0 Use silverstripe/graphql:^4 functionality. */ class PublicationNoticeType extends TypeCreator { /** * @return array */ public function attributes() { return [ 'name' => 'PublicationNotice', 'description' => 'Describes an error that occurred on a failed publication operation', ]; } /** * @return array */ public function fields() { return [ 'noticeType' => [ 'type' => Type::nonNull(Type::string()), 'description' => 'The type of notice', ], 'message' => [ 'type' => Type::string(), 'description' => 'Relevant information pertaining to the error', ], 'ids' => [ 'type' => Type::listOf(Type::id()), 'description' => 'Relevant record IDs', ], ]; } /** * @param OperationException $value * @param array $args * @param array $context * @param ResolveInfo $info * @return mixed * @throws Exception */ public function resolveField($value, $args, $context, ResolveInfo $info) { $fieldName = $info->fieldName; $method = 'get'.$fieldName; if (method_exists($value, $method)) { return $value->$method(); } throw new Exception(sprintf( 'Invalid field %s on %s', $fieldName, get_class($value) )); } } |