Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 10 additions & 55 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 4
path: src/DependencyInjection/Configuration.php

-
message: "#^Call to static method addConfigLocationWithWriteTargetNodes\\(\\)\\ on an unknown class Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper.$#"
count: 1
path: src/DependencyInjection/Configuration.php

-
message: "#^Call to an undefined static method Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper\\:\\:getConfigNodeFromSymfonyTree\\(\\)\\.$#"
count: 1
path: src/DependencyInjection/PimcoreDataHubExtension.php

-
message: "#^Call to an undefined static method Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper\\:\\:getSymfonyConfigFiles\\(\\)\\.$#"
count: 1
path: src/DependencyInjection/PimcoreDataHubExtension.php

-
message: "#^Call to an undefined static method Pimcore\\\\Config\\\\LocationAwareConfigRepository\\:\\:getStorageConfigurationCompatibilityLayer\\(\\)\\.$#"
count: 1
path: src/Configuration/Dao.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 3
path: src/DependencyInjection/Configuration.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\AssetType\\\\AssetFolderType has an unused parameter \\$config\\.$#"
count: 1
Expand All @@ -35,11 +20,6 @@ parameters:
count: 1
path: src/GraphQL/AssetType/AssetInputType.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/GraphQL/AssetType/AssetTreeType.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\AssetType\\\\AssetType has an unused parameter \\$context\\.$#"
count: 1
Expand Down Expand Up @@ -120,11 +100,6 @@ parameters:
count: 1
path: src/GraphQL/DataObjectType/AbstractRelationsType.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/GraphQL/DataObjectType/AbstractRelationsType.php

-
message: "#^Instanceof between Pimcore\\\\Model\\\\DataObject\\\\ClassDefinition and Pimcore\\\\Model\\\\DataObject\\\\Fieldcollection\\\\Definition will always evaluate to false\\.$#"
count: 1
Expand Down Expand Up @@ -180,11 +155,6 @@ parameters:
count: 1
path: src/GraphQL/DataObjectType/LocalizedType.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/GraphQL/DataObjectType/MergeType.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\DataObjectType\\\\ObjectFolderType has an unused parameter \\$config\\.$#"
count: 1
Expand All @@ -205,11 +175,6 @@ parameters:
count: 1
path: src/GraphQL/DataObjectType/ObjectTreeType.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/GraphQL/DataObjectType/ObjectTreeType.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\DataObjectType\\\\PimcoreObjectType has an unused parameter \\$context\\.$#"
count: 1
Expand Down Expand Up @@ -300,6 +265,11 @@ parameters:
count: 1
path: src/GraphQL/DocumentElementType/RelationsType.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/GraphQL/DocumentElementType/RenderletType.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\DocumentElementType\\\\ScheduledblockDataInputType has an unused parameter \\$context\\.$#"
count: 1
Expand Down Expand Up @@ -375,16 +345,6 @@ parameters:
count: 1
path: src/GraphQL/FieldHelper/AbstractFieldHelper.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/GraphQL/General/AnyDocumentTargetType.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/GraphQL/General/AnyTargetType.php

-
message: "#^Constructor of class Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\General\\\\FolderType has an unused parameter \\$context\\.$#"
count: 1
Expand All @@ -400,11 +360,6 @@ parameters:
count: 1
path: src/GraphQL/Mutation/Operator/Factory/DefaultMutationOperatorFactoryBase.php

-
message: "#^If condition is always true\\.$#"
count: 1
path: src/GraphQL/PropertyType/ObjectsType.php

-
message: "#^Call to an undefined method Pimcore\\\\Bundle\\\\DataHubBundle\\\\GraphQL\\\\DataObjectMutationFieldConfigGeneratorInterface\\:\\:getGraphQlMutationFieldConfig\\(\\)\\.$#"
count: 1
Expand Down
31 changes: 31 additions & 0 deletions src/GraphQL/DocumentElementQueryFieldConfigGenerator/Renderlet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\DataHubBundle\GraphQL\DocumentElementQueryFieldConfigGenerator;

use Pimcore\Bundle\DataHubBundle\GraphQL\DocumentElementType\RenderletType;

class Renderlet extends Base
{
/**
* @return RenderletType
*
* @throws \Exception
*/
public function getFieldType()
{
return RenderletType::getInstance($this->getGraphQlService());
}
}
104 changes: 104 additions & 0 deletions src/GraphQL/DocumentElementType/RenderletType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\DataHubBundle\GraphQL\DocumentElementType;

use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use Pimcore\Bundle\DataHubBundle\GraphQL\ElementDescriptor;
use Pimcore\Bundle\DataHubBundle\GraphQL\Service;
use Pimcore\Model\Document\Editable\Renderlet;

class RenderletType extends ObjectType
{
protected static $instance;

/**
* @return RenderletType
*
* @throws \Exception
*/
public static function getInstance(Service $graphQlService)
{
if (!self::$instance) {
$anyTargetType = $graphQlService->buildGeneralType('anytarget');

$config =
[
'name' => 'document_editableRenderlet',
'fields' => [
'_editableType' => [
'type' => Type::string(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Renderlet) {
return $value->getType();
}
},
],
'_editableName' => [
'type' => Type::string(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Renderlet) {
return $value->getName();
}
},
],
'id' => [
'type' => Type::int(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Renderlet) {
return $value->getId();
}
},
],
'type' => [
'type' => Type::string(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Renderlet) {
return $value->getType();
}
},
],
'subtype' => [
'type' => Type::string(),
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) {
if ($value instanceof Renderlet) {
return $value->getSubtype();
}
},
],
'relation' => [
'type' => $anyTargetType,
'resolve' => static function ($value = null, $args = [], $context = [], ResolveInfo $resolveInfo = null) use ($graphQlService) {
if ($value instanceof Renderlet) {
$target = $value->getO();
if ($target) {
$desc = new ElementDescriptor($target);
$graphQlService->extractData($desc, $target, $args, $context, $resolveInfo);

return $desc;
}
}
},
],
],
];
self::$instance = new static($config);
}

return self::$instance;
}
}
6 changes: 5 additions & 1 deletion src/Resources/config/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ services:
tags:
- { name: pimcore.datahub.graphql.documentelementquerytypegenerator, id: typegenerator_documentelementquerydatatype_relations }

pimcore.datahub.graphql.documentelementquerytypegenerator_datatype_renderlet:
class: Pimcore\Bundle\DataHubBundle\GraphQL\DocumentElementQueryFieldConfigGenerator\Renderlet
tags:
- { name: pimcore.datahub.graphql.documentelementquerytypegenerator, id: typegenerator_documentelementquerydatatype_renderlet }

pimcore.datahub.graphql.documentelementquerytypegenerator_datatype_scheduledblock:
class: Pimcore\Bundle\DataHubBundle\GraphQL\DocumentElementQueryFieldConfigGenerator\Scheduledblock
tags:
Expand Down Expand Up @@ -1235,4 +1240,3 @@ services:
Pimcore\Bundle\DataHubBundle\GraphQL\ElementTag:
tags:
- { name: pimcore.datahub.graphql.elementtag, id: element_tag }

1 change: 0 additions & 1 deletion tests/_support/Helper/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace Pimcore\Bundle\PimcoreDataHubBundle\Tests\Helper;

use Pimcore\Model\DataObject\Unittest;
use Pimcore\Tests\Support\Helper\Model;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;

Expand Down