### Installing Pimcore Datahub Bundle - Bash Source: https://github.com/pimcore/data-hub/blob/2.x/doc/01_Installation_and_Upgrade/README.md This command executes the final installation steps for the Pimcore Datahub bundle using the Pimcore console. It typically performs database migrations, asset publishing, and other setup tasks required for the bundle to function correctly. ```bash bin/console pimcore:bundle:install PimcoreDataHubBundle ``` -------------------------------- ### Installing Pimcore Datahub Dependencies - Bash Source: https://github.com/pimcore/data-hub/blob/2.x/doc/01_Installation_and_Upgrade/README.md This command installs the necessary Composer dependencies for the Pimcore Datahub bundle. It fetches the bundle and its required packages, making them available for use in the project. ```bash composer require pimcore/data-hub ``` -------------------------------- ### Enabling Pimcore Datahub Bundle - PHP Source: https://github.com/pimcore/data-hub/blob/2.x/doc/01_Installation_and_Upgrade/README.md This PHP snippet demonstrates how to register the Pimcore Datahub bundle within the `config/bundles.php` file. Adding `PimcoreDataHubBundle::class => ['all' => true]` ensures the bundle is loaded across all environments. ```php use Pimcore\Bundle\DataHubBundle\PimcoreDataHubBundle; // ... return [ // ... PimcoreDataHubBundle::class => ['all' => true], // ... ]; ``` -------------------------------- ### Example Response for Asset Listing - JSON Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md This JSON object represents a sample response for the `getAssetListing` query. It shows an array of `edges`, where each `node` contains a `__typename` indicating whether it's an `asset_folder` or an `asset`. ```JSON { "data": { "getAssetListing": { "edges": [ { "node": { "__typename": "asset_folder" } }, { "node": { "__typename": "asset" } }, { "node": { "__typename": "asset" } }, { "node": { "__typename": "asset" } }, { "node": { "__typename": "asset" } } ] } } } ``` -------------------------------- ### Example JSON Response for Pimcore Asset Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md This JSON object represents a typical response from the getAsset GraphQL query. It provides the requested asset's ID, original fullpath, various thumbnail URLs, resolution details, srcset information, asset type, mimetype, filesize, and the base64 encoded data for the specified thumbnail. ```JSON { "data": { "getAsset": { "id": "4", "fullpath": "/Car%20Images/jaguar/auto-automobile-automotive-192499.jpg", "assetThumb": "/Car%20Images/jaguar/4/image-thumb__4__exampleCover/auto-automobile-automotive-192499.jpg", "assetThumb2": "/Car%20Images/jaguar/4/image-thumb__4__content/auto-automobile-automotive-192499.webp", "resolutions": [ { "url": "//Car%20Images/jaguar/image-thumb__4__content/auto-automobile-automotive-192499~-~768w@2x.jpg", "resolution": 2 }, { "url": "//Car%20Images/jaguar/image-thumb__4__content/auto-automobile-automotive-192499~-~768w@5x.jpg", "resolution": 5 } ], "srcset": [ { "descriptor": "768w", "url": "//Car%20Images/jaguar/image-thumb__4__content/auto-automobile-automotive-192499~-~768w.webp", "resolutions": [ { "url": "//Car%20Images/jaguar/image-thumb__4__content/auto-automobile-automotive-192499~-~768w@2x.webp", "resolution": 2 }, { "url": "//Car%20Images/jaguar/image-thumb__4__content/auto-automobile-automotive-192499~-~768w@5x.webp", "resolution": 5 } ] } ], "type": "image", "mimetype": "image/jpeg", "filesize": 113895, "data": "UklGRjh............." } } } ``` -------------------------------- ### Example JSON Response for Translation Listing Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/14_Sample_GetTranslationListing.md This JSON object represents the expected response from the `getTranslationListing` GraphQL query. It contains an array of translation nodes, each with a `key` and a `translations` string, where translations are themselves a JSON string of language-to-text mappings. ```JSON { "data": { "getTranslationListing": { "edges": [ { "node": { "key": "2-door berlinetta", "translations":"{\"de\":\"2 Türer Sportcoupé\",\"en\":\"\",\"fr\":\"\"}" } }, { "node": { "key": "2-door fastback coupé", "translations":"{\"de\":\"2 Türer Coupé\",\"en\":\"\",\"fr\":\"\"}" } }, { "node": { "key": "2-door hardtop", "translations":"{\"de\":\"2 Türer Hardtop\",\"en\":\"\",\"fr\":\"\"}" } }, { "node": { "key": "2-door roadster", "translations":"{\"de\":\"2 Türer Roadster\",\"en\":\"\",\"fr\":\"\"}" } } ] } } } ``` -------------------------------- ### Example JSON Response for Asset Thumbnail Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/AssetThumbnail.md This JSON object illustrates the expected response structure from the GraphQL query, providing the car's ID and the full URL for its content thumbnail, as configured in the Data Hub. ```json { "data": { "getCar": { "id": "82", "contentThumbnail": "/Car%20Images/ac%20cars/68/image-thumb__68__content/automotive-car-classic-149813.44c4f656.jpg" } } } ``` -------------------------------- ### Example Pimcore GraphQL Endpoint URL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/01_Configuration/15_Customize_Endpoint_URL.md This snippet provides a concrete example of the standard Pimcore GraphQL endpoint URL with specific values for the client name ('blogdemo') and API key ('12345'). It demonstrates how the placeholders are replaced. ```URL /pimcore-graphql-webservices/blogdemo?apikey=12345 ``` -------------------------------- ### Example JSON Response for Related Car Objects Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md This JSON object illustrates the structure of the data returned by the GraphQL query for related `Car` objects. It includes the queried car's details, its parent, a list of children with their specific attributes (like color), and a list of siblings, demonstrating the hierarchical and relational data retrieval. ```json { "data": { "getCar": { "id": "261", "name": "1900", "parent": { "id": "260", "name": "1900" }, "children": [ { "id": "263", "name": "1900", "color": [ "black" ] }, { "id": "262", "name": "1900", "color": [ "silver" ] } ], "_siblings": [ { "id": "264", "name": "1900 Sprint" } ] } } } ``` -------------------------------- ### Example Response for Manufacturer Listing Query - JSON Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md This JSON object represents the expected response from the 'getManufacturerListing' GraphQL query. It contains an 'edges' array, where each 'node' represents a manufacturer with its ID, name, and logo details. The 'totalCount' field indicates the total number of available manufacturers matching the query criteria. ```json { "data": { "getManufacturerListing": { "edges": [ { "node": { "id": "28", "name": "Alfa Romeo", "logo": { "id": "290", "fullpath": "/Brand%20Logos/Alfa_Romeo_logo.png" } } }, { "node": { "id": "240", "name": "Aston Martin", "logo": { "id": "291", "fullpath": "/Brand%20Logos/Aston_Martin_Logo_2018.png" } } }, { "node": { "id": "35", "name": "Austin-Healey", "logo": { "id": "292", "fullpath": "/Brand%20Logos/Austin-Healey-Logo.jpg" } } } ], "totalCount": 27 } } } ``` -------------------------------- ### Example JSON Response for Asset Metadata Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md This JSON object represents the expected response from the 'Querying Asset Metadata in GraphQL' query. It includes the asset's basic information and an array of custom metadata entries, each detailing name, type, data, and language. ```JSON { "data": { "getAsset": { "id": "4", "fullpath": "/Car%20Images/jaguar/auto-automobile-automotive-192499.jpg", "type": "image", "mimetype": "image/jpeg", "filesize": 113895, "metadata": [ { "name": "author", "type": "input", "data": "Mike", "language": "" }, { "name": "authorLink", "type": "input", "data": "https://www.pexels.com/@mikebirdy", "language": "" }, { "name": "copyright", "type": "input", "data": "Mike (https://www.pexels.com/@mikebirdy) | Pexels License", "language": "" }, { "name": "license", "type": "input", "data": "Pexels License", "language": "" }, { "name": "licensePath", "type": "input", "data": "https://www.pexels.com/photo-license/", "language": "" }, { "name": "source", "type": "input", "data": "https://www.pexels.com/photo/auto-automobile-automotive-car-192499/", "language": "" } ] } } } ``` -------------------------------- ### Example JSON Response for Document Properties Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/05_Sample_Element_Properties.md This JSON object represents the expected response structure from the GraphQL query for document properties. It shows how different property types (document, asset, object) are represented, including their `__typename`, `name`, and specific data fields like `fullpath`, `filesize`, and nested object details. ```JSON { "data": { "getDocument": { "fullpath": "/en/More-Stuff/Developers-Corner/Editable-Roundup", "properties": [ { "__typename": "property_document", "name": "newsletter_confirm_mail", "type": "document", "document": { "__typename": "document_email", "id": "105", "fullpath": "/en/mails/newsletter_confirm", "controller": "@AppBundle\\Controller\\DefaultController", "action": "genericMail" } }, { "__typename": "property_asset", "name": "mylogo", "asset": { "fullpath": "/Brand%20Logos/Alfa_Romeo_logo.png", "logothumb": "/Brand%20Logos/image-thumb__290__content/Alfa_Romeo_logo.webp", "filesize": 101613 } }, { "__typename": "property_object", "name": "myobject", "object": { "id": "273", "name": "Gulietta Sprint Speciale", "color": [ "green" ] } } ] } } } ``` -------------------------------- ### Example Response for Get Translation Query in JSON Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/10_Sample_GetTranslation.md This JSON object represents the expected response from the 'getTranslation' GraphQL query. It includes the translation details such as the 'translations' object (with language-specific values), 'domain', 'key', and 'type' of the translation. ```JSON { "data": { "getTranslation": { "translations": "{\"de\":\"\",\"en\":\"\",\"fr\":\"\"}", "domain": "messages", "key": "BMW", "type": "simple" } } } ``` -------------------------------- ### Requesting Asset Listing - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md This GraphQL query requests a listing of assets. It fetches the `__typename` for each node within the `edges` of the `getAssetListing` query, which can represent either an asset folder or an individual asset. ```GraphQL { getAssetListing { edges { node { __typename } } } } ``` -------------------------------- ### Example Response for Car Data Query (JSON) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md This JSON object represents the expected response from the GraphQL query, showing the retrieved car details, including the manufacturer's ID, name, logo full path, and the path to the generated custom thumbnail. It illustrates the structure of linked data and asset information returned by the API. ```json { "data": { "getCar": { "name": "Montreal", "frenchName": null, "productionYear": 1970, "cylinders": 8, "manufacturer": { "id": "28", "name": "Alfa Romeo", "logo": { "fullpath": "/Brand%20Logos/Alfa_Romeo_logo.png", "filesize": 101613 }, "customThumbnail": "/Brand%20Logos/image-thumb__290__galleryLightbox/Alfa_Romeo_logo.webp" } } } } ``` -------------------------------- ### Example JSON Response for Asset Embedded Meta Info Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md This JSON object shows the response for the 'Querying Asset Embedded Meta Info in GraphQL' query. It provides an array of name-value pairs representing various embedded technical metadata attributes of the asset, such as FileSize, MIMEType, ImageWidth, and SVGVersion. ```JSON { "data": { "getAsset": { "embeddedMetaInfo": [ { "name": "FileSize", "value": "395 kB" }, { "name": "FileModifyDate", "value": "2019:06:07 12:21:26+02:00" }, { "name": "FileAccessDate", "value": "2019:06:07 12:21:26+02:00" }, { "name": "FileInodeChangeDate", "value": "2019:06:07 12:21:26+02:00" }, { "name": "FilePermissions", "value": "rwxrwxr-x" }, { "name": "FileType", "value": "SVG" }, { "name": "FileTypeExtension", "value": "svg" }, { "name": "MIMEType", "value": "image/svg+xml" }, { "name": "ImageWidth", "value": "383.921649993" }, { "name": "ImageHeight", "value": "260.469812009" }, { "name": "ViewBox", "value": "0 0 849 576" }, { "name": "SVGVersion", "value": "1.1" }, { "name": "Xmlns", "value": "http://www.w3.org/2000/svg" }, { "name": "Style", "value": "fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;" }, { "name": "ImageSize", "value": "383.921649993x260.469812009" }, { "name": "Megapixels", "value": "352991.9" } ], "tags": null } } } ``` -------------------------------- ### Perform PHPStan Analysis in data-hub only context (Bash) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/30_Testing.md This snippet demonstrates how to run PHPStan analysis specifically for the `data-hub` project by first setting up the Pimcore environment, installing project dependencies, and then executing PHPStan with no memory limit. It's intended for isolated analysis of the data-hub component. ```bash .github/ci/scripts/setup-pimcore-environment.sh composer install vendor/bin/phpstan analyse --memory-limit=-1 ``` -------------------------------- ### Example JSON Response for Asset Thumbnail HTML Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/AssetThumbnailHTML.md This JSON object represents the response to the GraphQL query, showing the `id` of the car and the `contentThumbnailHTML` field containing the generated HTML `` tag for the asset's thumbnail. The HTML includes `source` and `img` tags with `srcset` for responsive images. ```JSON { "data": { "getCar": { "id": "82", "contentThumbnailHTML": "\n\t\n\t\"\"\n\n" } } } ``` -------------------------------- ### Perform PHPStan Analysis in Pimcore context (Bash) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/30_Testing.md This snippet shows how to perform PHPStan analysis within a broader Pimcore context. It involves requiring a specific PHPStan version as a development dependency and then running the analysis using a configuration file provided by `vendor/pimcore/data-hub/phpstan.neon` to ensure compatibility with the full Pimcore setup. ```bash composer require "phpstan/phpstan:^1.4" --dev vendor/bin/phpstan analyse -c vendor/pimcore/data-hub/phpstan.neon --memory-limit=-1 ``` -------------------------------- ### Example JSON Response for Classification Store Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/08_ClassificationStore.md This JSON object illustrates the expected response structure when querying classification store data. It shows the csfield as an array containing groups, each with a features array that can include different types of classification store features (e.g., csFeatureInput, csFeatureQuantityValue, csFeatureTextarea) and their respective data. ```json { "data": { "getCstest": { "id": "107", "classname": "cstest", "qvfield": { "unit": { "abbreviation": "cm" }, "value": 3 }, "csfield": [ { "id": 2, "name": "Group1", "description": "Some group description", "features": [ { "__typename": "csFeatureInput", "type": "input", "id": 2, "name": "The name of my key definition", "description": "The description ...", "text": "C" }, { "__typename": "csFeatureQuantityValue", "type": "quantityValue", "id": 3, "description": "A quantityValue key definition", "quantityvalue": { "unit": { "abbreviation": "mm", "longname": "millimeter" }, "value": 2 } }, { "__typename": "csFeatureTextarea", "text": "Hello, I am a textarea", "name": "key4" } ] } ] } } } ``` -------------------------------- ### Example Response for Substring Operator in JSON Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/Substring.md This JSON response shows the result of the GraphQL query, illustrating how the 'ShortDescription' field has been truncated and appended with an ellipsis, as configured by the Substring operator. ```JSON { "data": { "getCar": { "id": "82", "description": "

Description that clearly exceeds 10 characters in length

", "ShortDescription": "

Descript..." } } } ``` -------------------------------- ### Fetching Language-Specific Document Translation Link (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/01_Document_Queries.md This example shows how to fetch a specific translation link for a document page by providing a `defaultLanguage` argument (e.g., 'de'). This allows retrieving only the translation relevant to the specified language. ```GraphQL { getDocument(id: 76) { ... on document_page { id translations(defaultLanguage: "de") { ... } } } } ``` -------------------------------- ### Querying Translations with GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/14_Sample_GetTranslationListing.md This GraphQL query retrieves a list of translations, specifically filtering by the 'messages' domain. It fetches the translation key and all associated translations for each node. ```GraphQL { getTranslationListing (domain: "messages") { edges { node { ... on translation { key, translations } } } } } ``` -------------------------------- ### Applying Simple Sorting to Listing - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/04_Asset_Queries.md This GraphQL query shows how to sort a listing by a specific field and order. The `sortBy` parameter specifies the field (e.g., 'filename'), and `sortOrder` defines the direction ('DESC' for descending). This example uses `getManufacturerListing` but the sorting logic applies to other listings as well. ```GraphQL { getManufacturerListing(sortBy: "filename", sortOrder: "DESC") { edges { node { id name } } } } ``` -------------------------------- ### Example Response for Trimmed Car Data (JSON) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/Trimmer.md This JSON object represents the response to the GraphQL query, showing the `getCar` object with its `id`, original `name` (with leading/trailing spaces), and the `TrimmedName` field, which illustrates the result of the 'right' trim operation on the `name` field. ```json { "data": { "getCar": { "id": "82", "name": " Cobra 427 ", "TrimmedName": " Cobra 427" } } } ``` -------------------------------- ### Querying Pimcore Asset Details with GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md This GraphQL query demonstrates how to retrieve comprehensive details for a specific asset by its ID (e.g., id: 4). It allows fetching the original fullpath, various thumbnail URLs using different configurations (exampleCover, content), specifying formats like webp, and retrieving resolution and srcset information. Additionally, it can fetch asset type, mimetype, filesize, and base64 encoded content for a specified thumbnail. ```GraphQL { getAsset(id: 4) { id # original fullpath, # thumbnail URL for exampleCover config assetThumb: fullpath(thumbnail: "exampleCover") # thumbnail URL for content config assetThumb2: fullpath(thumbnail: "content", format: "webp") resolutions(thumbnail: "content", types: [2,5]) { resolution url } srcset(thumbnail: "content") { url descriptor # if types is not defined, then default resolutions @2x will be returned resolutions(types: [2,5]) { url resolution } } type mimetype # original file size filesize # base 64 encoded "content" thumbnail data(thumbnail:"content") } } ``` -------------------------------- ### Fetching Document Page with All Inherited Editables (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/01_Document_Queries.md This example illustrates how to fetch a document page by ID and retrieve all its editables, including those inherited from parent documents. The `getInheritedValues: true` argument ensures that inherited editable fields are also included in the response. ```GraphQL { getDocument(id: 207) { ... on document_page { id, editables(getInheritedValues: true ){ __typename } } } } ``` -------------------------------- ### GraphQL Manufacturer Listing Response Example Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/10_Filtering.md This JSON snippet shows the expected response structure for the GraphQL query that filters 'Manufacturer' objects. It includes the 'id' and 'name' of the matching manufacturers and the 'totalCount' of results. ```json { "data": { "getManufacturerListing": { "edges": [ { "node": { "id": "45", "name": "Cadillac" } }, { "node": { "id": "80", "name": "AC Cars" } }, { "node": { "id": "153", "name": "MG Cars" } } ], "totalCount": 3 } } } ``` -------------------------------- ### Querying a Single Translation in GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/10_Sample_GetTranslation.md This GraphQL query retrieves a single translation entry by its key. It specifies the 'key' parameter and requests 'translations', 'domain', 'key', and 'type' fields in the response. ```GraphQL { getTranslation (key: "BMW") { translations domain key type } } ``` -------------------------------- ### Getting List of Data Objects by Fullpaths - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/05_DataObject_Queries.md This GraphQL snippet illustrates how to fetch a list of data objects, such as 'News' listings, by specifying their full paths. It includes 'totalCount' for the total number of results and 'edges' to access individual 'node' objects and their 'id'. ```graphql { getNewsListing(fullpaths: "/NewsArticle,/NewsArticle2") { totalCount edges { node { id } } } } ``` -------------------------------- ### Example Response for Advanced Many-to-Many Object Relation Query in GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/22_Sample_Advanced_ManyToMany_Object_Relation.md This JSON response demonstrates the structure of data returned by the GraphQL query for an `AccessoryPart` object. It shows the `id` and `classname` of the main object, and how the `advAdditionalCategories` array contains `element` objects (representing related categories) and their associated `metadata` (e.g., `altName`). ```JSON { "data": { "getAccessoryPart": { "id": "408", "classname": "AccessoryPart", "advAdditionalCategories": [ { "element": { "id": "392", "classname": "Category" }, "metadata": [ { "name": "altName", "value": "AlternativeNameForCategory" } ] } ] } } } ``` -------------------------------- ### Querying Manufacturer Listing with Pagination and Sorting - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md This GraphQL query retrieves a list of manufacturers. It uses the 'first' argument for limiting the number of results (e.g., 3), the 'after' argument for offsetting the results (e.g., 1), and 'sortBy' to order the results by the manufacturer's name. The query fetches the manufacturer's ID, name, and logo details (ID and full path). ```graphql { # 'first' is the limit # 'after' the offset getManufacturerListing(first: 3, after: 1, sortBy: "name") { edges { node { id name logo { id fullpath } } } } } ``` -------------------------------- ### Querying Related Objects for a Car in GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md This GraphQL query demonstrates how to fetch the parent, children, and siblings of a specific `object_Car` by its ID (261). It utilizes the `objectTypes` argument to filter children to include `variant` and `object` types, showcasing flexible relationship querying in Pimcore Data Hub. ```graphql { getCar(id: 261) { id name parent { ... on object_Car { id name } } children(objectTypes: ["variant", "object"]) { ... on object_Car { id name color } } _siblings { ... on object_Car { id name } } } } ``` -------------------------------- ### Fetching Document Page and Date Editable (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/01_Document_Queries.md This query demonstrates how to retrieve a specific document page by its ID and extract data from a 'document_editableDate' field. It shows how to get the editable's name, its Unix timestamp, and a formatted date string. ```GraphQL { getDocument(id: 25) { ... on document_page { fullpath editables { ...on document_editableDate { _editableName # unix timestamp timestamp # as formatted string formatted(format:"Y-m-d") } } } } } ``` -------------------------------- ### Example Response for Aliased Car Query - JSON Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Using_Aliases.md This JSON object represents the expected response from the GraphQL query that uses an alias. It shows the `getCar` object with the `numberOfDoors` field successfully aliased to `doors`, containing the value 2. ```JSON { "data": { "getCar": { "doors": 2 } } } ``` -------------------------------- ### Configuring Data Hub Write Target (YAML) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/20_Deployment.md Defines the storage location and write target for Data Hub configurations within the Pimcore Symfony tree. This example sets the write target to 'symfony-config', storing YAML files in a specified directory, which are only revalidated in debug mode in production. ```yaml pimcore_data_hub: config_location: data_hub: write_target: type: 'symfony-config' options: directory: '/var/www/html/var/config/data_hub' ``` -------------------------------- ### Example JSON Result for Static Text Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/StaticText.md This JSON object represents the expected response from the GraphQL query, showing the 'id' of the car and the value of the 'StaticTextForQuery' field. The 'StaticTextForQuery' field is populated with the pre-configured static text, demonstrating the feature's output. ```json { "data": { "getCar": { "id": "81", "StaticTextForQuery": "StaticTextForQuery" } } } ``` -------------------------------- ### Getting Single Data Object - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/05_DataObject_Queries.md This GraphQL snippet demonstrates the base structure for retrieving a single data object by its ID. It queries for a 'News' object with an ID of 4. The '...' indicates that specific fields of the object would be requested here. ```graphql { getNews(id: 4) { ... } } ``` -------------------------------- ### Example JSON Response for Concatenated Field Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/Concatenator.md This JSON response illustrates the output of a GraphQL query for a concatenated field. It shows the id of the car and the ConcatYearCountry field, which contains the combined '1966-GB' value, demonstrating the successful application of the Concatenator. ```json { "data": { "getCar": { "id": "82", "ConcatYearCountry": "1966-GB" } } } ``` -------------------------------- ### Getting List of Data Objects with Quoted Fullpaths - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/05_DataObject_Queries.md This GraphQL snippet demonstrates how to handle fullpaths that contain commas by quoting each path. This ensures that commas within a path are not misinterpreted as list separators when querying for a list of data objects by their fullpaths. ```graphql { getNewsListing(fullpaths: "'/NewsArticle,Headline','/NewsArticle2'") { totalCount edges { node { id } } } } ``` -------------------------------- ### Example Response for Formatted Date Query (JSON) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/DateFormatter.md This JSON object represents the expected response from the GraphQL query, providing the car's ID, its modification date as a Unix timestamp, and the same modification date formatted into a human-readable string according to the date formatter's configuration. ```json { "data": { "getCar": { "id": "82", "modificationDate": 1732709167, "FormattedModificationDate": "Wednesday 27th of November 2024 12:06:07" } } } ``` -------------------------------- ### Example GraphQL Request for Static Text Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/08_Operators/Query/StaticText.md This GraphQL query demonstrates how to retrieve car data by ID and include a static text field, 'StaticTextForQuery', in the response. The 'getCar' field takes an 'id' parameter to specify the desired car, and the static text is added as a selectable field. ```graphql { getCar(id: 82) { id, StaticTextForQuery } } ``` -------------------------------- ### Example Response for Translated Condition (JSON) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/27_Sample_Translate_Values.md This JSON object represents the expected response from the GraphQL query, showcasing the original 'condition' value ('broken') and its translated, human-readable equivalent ('nicht mehr zu gebrauchen :-)') as processed by the website translator. ```json { "data": { "getAccessoryPart": { "condition": "broken", "translatedCondition": "nicht mehr zu gebrauchen :-)" } } } ``` -------------------------------- ### Example JSON Response for Field Collection Query Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/24_Sample_Fieldcollections.md This JSON object represents the expected response from the GraphQL query, showcasing how data from various field collection types (`fieldcollection_NewsText`, `fieldcollection_NewsCars`) and their nested related objects (`object_Car`) are structured. It highlights the `__typename` field for type identification and the array structure for multiple field collection entries. ```json { "data": { "getNews": { "content": [ { "__typename": "fieldcollection_NewsText", "text": "

Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectueter eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus.

\n\n

Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit.

\n" }, { "__typename": "fieldcollection_NewsCars", "title": "XYZ", "relatedCars": [ { "__typename": "object_Car", "name": "Impala", "color": [ "white" ] }, { "__typename": "object_Car", "name": "Impala", "color": [ "white" ] }, { "__typename": "object_Car", "name": "Coupe De Ville", "color": [ "blue" ] }, { "__typename": "object_Car", "name": "Bel Air", "color": [ "red", "white" ] } ] } ] } } } ``` -------------------------------- ### Fetching Document Page via Data Object Relation and Editable Data (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/01_Document_Queries.md This complex query demonstrates fetching a data object by ID, traversing a many-to-one relation to a document page, and then extracting specific editable data. It shows how to get a link editable's details and resolve its internal target, which can be either another document page (with its input editables) or a news object (with its short text). ```GraphQL { getTest3(id: 61) { manytoone { ... on document_page { fullpath editables { ... on document_editableLink { _editableType _editableName data { internal path target { __typename ... on document_page { id fullpath editables { ... on document_editableInput { name text } } } ... on object_news { shortText } } } } } } } } } ``` -------------------------------- ### Querying Car Data with Linked Manufacturer and Logo Thumbnail (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md This GraphQL query retrieves details for a specific car by ID, including its name in English and French, production year, cylinders, and linked manufacturer information. It also fetches the manufacturer's logo full path and a custom generated thumbnail, demonstrating how to access related object data and asset thumbnails. ```graphql { getCar(id:277, defaultLanguage:"en") { name frenchName: name(language: "fr") productionYear cylinders manufacturer { ...on object_Manufacturer { id name logo { fullpath } customThumbnail } } } } ``` -------------------------------- ### Querying Asset Metadata in GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md This GraphQL query retrieves standard metadata for a specific asset (ID 4) in the 'de' language. It fetches basic asset details like ID, full path, type, mimetype, filesize, and custom metadata fields such as name, type, data, and language. ```GraphQL { getAsset(id: 4, defaultLanguage: "de") { id fullpath type mimetype filesize metadata { name type data language } } } ``` -------------------------------- ### Sample Data Hub Configuration File (YAML) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/20_Deployment.md Provides a template for defining Data Hub configurations directly in a Symfony YAML file, bypassing the UI for editing. This allows for programmatic definition of general settings, schema details, and entity permissions (read, create, update, delete) for various types like documents. ```yaml pimcore_data_hub: configurations: : general: active: true type: '' name: '' description: '' group: ' sqlObjectCondition: '' modificationDate: path: '' createDate: ' schema: queryEntities: { } mutationEntities: { } specialEntities: document: read: false create: false update: false delete: false ... ``` -------------------------------- ### Rebuilding All Data Hub Workspaces (Bash) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/20_Deployment.md Executes the command to rebuild all Data Hub workspaces. This is necessary after deploying configuration changes to ensure permissions and definitions are up-to-date for optimal query performance. ```bash datahub:configuration:rebuild-workspaces ``` -------------------------------- ### Creating a Link Document using GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/03_FreeformAPI_Create_new_Link_Document.md This GraphQL mutation creates a new link document. It requires a unique `key`, a `parentId` for its location, and an `input` object specifying the `internal` ID and `internalType` (e.g., 'asset') of the target. ```GraphQL mutation {\n createDocumentLink(key: "newlinkdocument", parentId:1, input: {\n internal:308\n internalType:"asset" \n } \n \n ) {\n success\n }\n} ``` -------------------------------- ### Applying Pagination to Asset Listing - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/04_Asset_Queries.md This GraphQL query demonstrates how to apply pagination to an asset listing. The `first` parameter limits the number of results, while `after` acts as an offset, allowing for fetching a specific subset of the listing. This is crucial for handling large datasets efficiently. ```GraphQL { # 'first' is the limit # 'after' the offset getAssetListing(first: 3, after: 1) { edges { ... } } } ``` -------------------------------- ### Example Response for Advanced Many-to-Many Relation Metadata Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/11_Query_Samples/23_Sample_Advanced_ManyToMany_Relation_Metadata.md This JSON response illustrates the data structure returned by the GraphQL query for getAccessoryPart. It shows the id and classname of the main object, followed by an array additionalLinkedElements. Each element in this array contains an element object (representing the linked asset, document, or object with its specific fields like id, fullpath, or name) and a metadata array, which holds name-value pairs describing additional attributes of the relation. ```json { "data": { "getAccessoryPart": { "id": "408", "classname": "AccessoryPart", "additionalLinkedElements": [ { "element": { "id": "97", "fullpath": "/en/Find-and-Buy/On-Sale" }, "metadata": [ { "name": "altName", "value": "OnSale" } ] }, { "element": { "id": "33", "fullpath": "/Car%20Images/austin%20healey/austin-healey-1019023.jpg" }, "metadata": [ { "name": "altName", "value": "CarImage" } ] }, { "element": { "id": "35", "name": "Austin-Healey" }, "metadata": [ { "name": "altName", "value": "Manufacturer" } ] } ] } } } ``` -------------------------------- ### Requesting Video Asset Thumbnails - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/04_Asset_Queries.md This GraphQL query retrieves a video asset by ID and requests a specific video thumbnail configuration. The `thumbnail:fullpath` field, with `thumbnail: "content"`, specifies the desired thumbnail configuration. This allows for fetching pre-configured video previews. ```GraphQL query { getAsset(id:353) { id, thumbnail:fullpath(thumbnail: "content"), } } ``` -------------------------------- ### Requesting Image Asset Thumbnails with Deferred Generation - GraphQL Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/04_Asset_Queries.md This GraphQL query fetches an image asset by ID and requests a specific image thumbnail configuration. The `thumbnail:fullpath` field, with `thumbnail: "events_header"`, specifies the configuration. The `deferred:true` parameter indicates that the thumbnail generation should be delayed until it's first requested, optimizing performance. ```GraphQL query { getAsset(id:289) { id, thumbnail:fullpath(thumbnail: "events_header", deferred:true) } } ``` -------------------------------- ### Fetching Full Rendered Document Page (GraphQL) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/10_GraphQL/04_Query/01_Document_Queries.md This snippet shows how to retrieve a fully rendered version of a document page using the `rendered` field. It allows passing various options like `attributes` for controller/action, `query` parameters, `options` for the renderer, and `use_layout` to enable or disable layout rendering. ```GraphQL { getDocument(id: 207) { ... on document_page { id, rendered( attributes: [{key: "myControllerAttributeName", value: "Hello World!"}], use_layout: true, options: [{key: "ignore_errors", value: "1"}] ) } } } ``` -------------------------------- ### Rebuilding Specific Data Hub Workspaces (Bash) Source: https://github.com/pimcore/data-hub/blob/2.x/doc/20_Deployment.md Executes the command to rebuild specific Data Hub workspaces, identified by their configuration names (e.g., 'assets', 'events'). This allows for targeted updates after deploying configuration changes. ```bash datahub:configuration:rebuild-workspaces --configs=assets,events ```