Many-to-many-fields work in Pimcore GraphQL (data-hub), though it might take you some time to figure out how it exactly works.

If you haven’t added data-hub, read this post first about data-hub.

Many-to-one field

Say we have object Fridge and object Brand. Object Fridge has a many-to-one field with Object Brand.

In order for this to work you have to add both object Fridge and Brand in the Schema Query.

Select the fields you want to be available in GraphQL for both objects (Fridge and Brand).
Select also the folders of the objects that should be available (in tab Security Definition under "objects"). They need to include the folders from both objects .

Click save.

Click "Open in Tab", this opens the editor ‘GraphiQL’ in a new browser tab.

Enter a variant of this query:

    getFridge (id: 141) {
        brand {
            ... on object_Brand {

The Many To One field requires:

  • the field name as it’s defined in the Fridge class (brand in this example)
  • 3 dots (…) followed by the fixed word object_ followed by the class name of the linked object (... on object_brand in this example)
  • the field names that you want to return from the brand.

Many-to-many fields

If you work with a many-to-many fields, you work exactly as in many-to-one fields. The only difference is an extra line in the query.

  • the fixed word element
    getFridge (id: 141) {
        brand {
            element {
                ... on object_Brand {

I discovered in some cases it also works without the "… on object_" line.

Possible errors:

Cannot query field "name" on type "object_Brand".

This happens when you didn’t add the object in the Schema Definition of the Datahub configuration.
The linked objects must also be defined.

Error "type definition … not found"

This was a bug on "Advanced Many-To-Many Object Relation" types. It’s fixed in the dev-mater branch of data-hub. See:

Execute the following command to fix this:

composer update pimcore/data-hub

Pimcore 5 offers a new package to use GraphQL. That way you can make Pimcore 5 headless. This means you can access Pimcore data, without having to visit that website, and without using REST or SOAP. The package for GraphQL is called data-hub and is still in dev, though it already works.

Add GraphQL (data-hub) package to Pimcore

  1. Add the "GraphQL" package to Pimcore with Composer. The package is called data-hub.

    composer require pimcore:data-hub:dev-master
  2. The package needs to be activated an installed. Go in Pimcore to Tools (tool-icon) > Extensions

  3. Click on the green plus-button on the line "PimcoreDataHub" (column Enable/Disable).

  4. You see a confirmation window. Click that away.

  5. Click on the install-icon on the same line.

  6. Refresh the browser.

Configure the data-hub.

If all goes well, you should see the "Datahub config" option under the Settings menu (gear-icon). If not, ensure the package is properly installed (or try to reinstall it).

To add a GraphQL configuration, clicking the "Add Configuration" button and select "GraphQL".

Scheme Definition

Click the Schema Definition tab .

First add the object-type you want to be queryable. In this example I use a custom object called "Fridge". (step 1)

To configure this object, click the gear icon (step 2).

You see the fields of this object in the left column. Drag and drop the fields you want to enable for the GraphQL query to the right column.

Security Definition

Click the Security Definition tab. (step 1)

Your api (= GraphQL service) must be protected by an api-key, to limit unauthorized access. The party (or application) that needs to query the data, must have a copy of that key. (step 2)

Now that you’ve configured the object, you must also select the folder of the objects that must be query-able. Objects outside those folders won’t be found. Drag and drop a folder in "Objects". (step 3)

Click "save" (step 4).

Enter queries

Click "Open in tab" to start experimenting.

The query-language of GraphQL is explained on the official GraphQL website, so I won’t go into detail about that.

  getFridge (id: 141) {

You can enter this as a test and you should see the results after clicking on the play-button (arrow) in the top bar.

You say "getFridge" with id 141; show the fields: name, id, description

You can only select the fields you’ve configured in the scheme definition. So if you want more fields, you have to go back to the configuration window.

Access api

You can access the api through the following url:

Where you replace: "", "fridge" (by the name of the configuration) and "abc" by the api-key.

Then you send to that api the complete query (with the braces), for instance with an ApolloClient (not covered in this blogpost). You should get the appropriate response.

If you locked yourself out of your WordPress account, and you can’t figure a way to log back in (even not with recover password), you can get around it by using the command line.

This will only work if you have ssh access and have installed WP-CLI. WP-CLI is such a handy tool, for instance, to automatically update your WordPress installations, that I would recommend it to everyone.

Once you have installed WP-CLI, enter this command in your WordPress project root folder.

wp user update myuser --user_pass=mypassword

Replace myuser and mypassword by your username and password.

Remember that it’s unsafe to enters passwords in plain text through the command line. It is for example tractable with the history command. Once you did this, login to WordPress and change your password the normal way.

Sorry for the clickbait title, but now you’re here, you might as well read about my thoughts (or "issues") on Open Source

1. Open source is the new demo

Companies used to make private software, but now they tend to create more open source. Though the open source product is only maintained by the company and is used as a step-up to the paying version.

Take OpenX for example, a package for online advertising. It comes in two flavors: an open source version (the original) and a priced private version. The open source version is far less superior and less maintained than the private.

That idea is inherited from the demo-age: a demo was a free version that missed the features to be useful. Today the demo version is licensed as open source, but just because open source is popular.

The open source package isn’t made to be perfect, no, it’s only made to get people warmed up for the paying version. (in terms of OpenX: the open source version has many security holes, which makes it hard to consider).

2. Open source is company karma

Companies get popular by releasing their open source libraries next to their private software. I may be cynic, but I feel like a lot of these packages are made for company karma. A lot of companies sponsor open source projects to gain karma from the community and eventually sell their services to them.

Because every company wants to have their own open source library, instead of contributing to a library from somebody else, you create a wide field of all sorts of packages that might be abandoned as soon as the company loses interest.

The real, well working open source projects are the ones that are supported and used by a wide range of people over a long period of time. These are not the ones that are created because marketing told us so.

3. Open source gets sold

I hear you thinking, if private companies want to contribute to open source, why shouldn’t they?

When MySQL was sold to Sun, they didn’t know that Oracle would buy Sun. Widenius, main-developer of MySQL, tried to avoid that Oracle would takeover MySQL at all costs. Right before Oracle bought Sun, he forked MySQL into MariaDB. As soon as Oracle bought MySQL they started adding closed source modules. So there are 2 software packages that are about the same: MySQL owned by Oracle which is partly open and partly closed, and MariaDB owned by Widenius, which is entirely open.

The danger of open source bought or created with private money, is that it might be transformed into closed source software or be taken away from the community. The open source version could be stopped, put on low priority, or be degraded to "demo".

These moves also cause confusion amongst users. Should they use Open Office or Libre Office? And do they care/know what the difference is? And what about organizations that use an open source package which suddenly transforms into closed source?

The idea behind open source (or community initiatives like Wikipedia or non-technology ones like Transition Network) is: you take from the community, you give to the community. Not necessary in terms of money, but in terms of your skills and your time – whatever your skill may be (even mouth to mouth publicity).

Most initiatives need money, so money will be welcomed, but your input is of most importance for the success rate of the project. Wikipedia needs money to run its server and pay its few employees, but even with that money they wouldn’t have made it without the help of all the voluntary writers and readers.

4. Forks create chaos

The open source community splits into branches. Splitting into branches is a human thing that has been around since the beginning of politics and religion. Splitting up creates quantity but not quality.

Just take a look at the discussions about Unity, the new desktop layout of Ubuntu. A part of the community solved it by suggesting another Ubuntu that didn’t implement Unity: Linux Mint. And while Linux Mint is great (I use it daily), why couldn’t we simply agree to stick to Ubuntu and implement the option to disable Unity. It’s open source so it’s possible.

This is where Open Source should make the difference with Microsoft. Microsoft did an equal move by removing the start-button and implementing a dysfunctional desktop (Metro) without any way to "change back to normal" (while Windows users crave for a solution to make their pc’s go faster and don’t care about a new desktop).

Instead of creating one successful well supported product, we create forks, versions that are just slightly different than the original.

All these branches, "doing this different because we believe it’s better" make it impossible to maintain oversight. This is the comparable to Microsoft trying to push their "standards" just for the sake of having an own (in their case: patented) standard.

There are dozens of ways (libraries) to upload a file on a website. If I really want to have the best solution, I have to go to all these projects, demo it or install it. It would be better to have one or two projects that are flexible and well supported by all browsers. Developers just have to learn working with 2 packages and can start working for any employer or follow up any project. It could be taught at school, it could be far more popular and better than any of the dozens of libraries today.

jQuery kind of goes into that direction by creating 1 flexible good javascript library that is wildly supported. But the jQuery-libraries by 3rd party developers make it a mess. There’s no oversight in all these modules, the quality is very different amongst projects, they could conflict with each-other or not be compatible with a new/old version of jQuery.

This is the real pain: "wild" libraries as opposed to "well supported" libraries. This is what gives open initiatives a bad name: the lack of equal quality. Because everybody can create open source, there’s no control, hence no quality assurance.

I am well aware of that contradiction. It’s a debate: do you allow anyone to contribute (democratic) and risk quality instabilities, or do you select the contributors that probably will assure quality but make it less open?

5. The question of what to do with “bad” contributors/modules?

At my [previous] job, an alternative online newspaper, we have a comparable problem. Many of our writers are volunteers, some of them can write good articles, some of them don’t. But what do we do with bad writers? There are 2 schools of thought:

  1. We allow bad writers to continue to write for an open democratic website, where everyone can report what they want, with the risk that bad articles can harm our quality level (and reputation). Bad writers take a lot of time and effort (it’s more work to rewrite a bad article than to write a good article yourself).

  2. We only keep the good writers. That would transform our website into a closed medium and conflict with our basic ideas. By maintaining a high standard we could scare away potential new volunteers who think they’re not good enough but might be.

Keep in mind that some volunteers are bad writers but have interesting things to say. Though, there aren’t enough resources to train every volunteer who fits that category.

We’ve discussed this for hours and it’s hard to figure out a middle way. Currently we have to idea to "star" contributions which we think are good, a quality label. We only want to make that clear with layout changes, because we don’t want to add a textual "warning-this-article-sucks-disclaimer". That kind of disapproval would make the volunteer displeased, if not angry.

I think that idea would work for Open Source as well, and some of them have started such an idea. Drupal contributors, for example, start with a sandbox project that has to be reviewed by an admin. If your sandbox is alright, it will be transformed into a module. Too bad, too many modules have features that are just slightly different than another. This confuses people: "what module should I use? Google Analytics Integrator? SEO Expert? or just the module named Google Analytics?"

6. Loosing sight of “The bigger plan”

Just "starring" doesn’t work if you allow every module by the simple rule that the contributor must be a good coder. There needs to be a bigger plan:

  • What modules do you want?
  • Are the current modules good enough?
  • Which modules should be replaced by better ones?
  • Who wants to manage that?
  • Do we allow everyone to contribute? Or how will we select?
  • Is the project “owned” by a private investor? And do we allow that?
  • How do we collect money in case we need it?
  • How do we get people to contribute?
  • How do we handle requests for certain modules that might not fit our software?
  • Do we risk losing users by not implementing certain features or do we implement everything just for the sake of attracting as many users as possible?
  • Who will decide what to implement? How is that process defined?
  • How do we handle bad content/contributors?
  • Is their a “leader”, someone who pulls the strings? A decision maker? And if not, how do we organize?

I know this comes scarily close to management, but these are questions any serious open project will have to answer some day. It would be a pity if open source projects fail by not thinking these through. These type of questions should be answered for every community project, and not just tech ones.

7. The lack of management skills amongst developers

The reason I think why these questions are left unanswered, is because it’s not a pleasant task and it doesn’t add production value right away. If I spent one week thinking about the questions, I loose one week of coding. And, maybe my time is limited to one week. In case of open source, most contributors are developers. And developers want to develop. They don’t want to waste time on the above questions, no, they want to code, rather now than tomorrow.

Many developers, like me, don’t like to "manage". They get behind their computer, start coding, and hope someone will spontaneously say "hey, can I contribute?". That someone would be a great coder with the exact state of mind as ourselves, and not some sucker who just created his first html-page.

Bonus! The scare of loosing the project to someone else

If I look deeper into myself, the thought that someone would "take over" my project, scares me. That’s perhaps another reason why some questions don’t get answered. If other people involve, I could loose the project, my name in bold on the about-page.

Of all the payed web-projects I left, every now and then, I check back on that site to see how things went on. What did they implement? What did they cut? How did they handle that complex js-problem?

It happens that nothing changed at all: the bug that was reported 5 years ago is still in it, the "temporary" solution has become older than my cat, and the space looks frighteningly… dead. Is this what I created? Did someone forget to turn that server off? Is it all forgotten?

Or, the other side, the project is gone, replaced by something flashy else, dumped on a backup harddisk in a basement.

Luckily, most of the times, the project appears to be in good shape, nice features have been added, developers clearly knew what they were doing. It has been handled respectful. This is what well managed open source projects should become. This is why the questions are important.

I better start thinking about the questions right away but first I want to code that feature that will make the project look awesome.

This tutorial explains how to created a single page with a login form an a register form in Drupal6.


To accomplish this, we have to go through some concepts first:

Continue reading “A custom login/register page for Drupal 6″…

It felt like a Monday morning. After my alarm clock didn’t get off (+ 1 hour), I noticed there was only a train 1 hour later, so instead of arriving at half past 9, I arrived at 11 and missed the first speaker.

Lightswith + Drupal

Anyhow. I picked up the last quarter of using Drupal together with Lightswitch (= Visual Studio). Apparently not a lot of devs had interest in the subject because there were only 20 people in the room. And those who didn’t attend were right, because all the speaker could tell us was that marrying Drupal and Lightswith could only result in a divorce.

Lightswitch can create a HTML5-admin environment based on a data layer. That data layer could be your Drupal database. Nothing works out the box for Drupal because MS of course wants to integrate their software (SharePoint, Office) and not someone else’s software.

Another downsides of all these MS-Drag-And-Drop-Automatic-Data-Layer-Builder-stuff, is that when you change your database, something on the other side might break and you could end up writing the data layer yourself (as a attendee commented). Plus, the actual html output looks weak and is unusable in a serious professional environment. Don’t try this at work, pro’s!

Drupal 8 discussion panel

Three Belgian core-devs (swentel, Wim Leers, aspilicious) had a one hour Q&A hour about Drupal 8. They all had a lot to tell so the number of actual public questions was limited.

You had to know some Drupal 8 in forehand, because new projects (say WSCCI, PSR or TWIG) were discussed without being explained.

The main message was that Drupal 8 is ready to port your modules to. But, there’s still a lot of work to be done. There are still upcoming API-changes, you can’t translate a node’s title yet and there are various other big and small release blockers. But: Views should be finished. Ah!

And why Drupal 8 should be better that its processors:

  • PSR proof. PSR is a PHP coding standard. (aimed for PSR 4 however, it’s uncertain if it the project will get there)
  • Display Suite is now a core module (however, is this really such a big plus?)
  • Getting rid of the hooks in favor for a more object oriented way (however, hooks still exist)

Continue reading “DrupalCamp Leuven 2013, a brief Saturday review.”…

A post for the Belgians… Drupalcamp 2013 is about to take place this weekend (september 14+15) in Leuven. The whole event is free, however  you have to register and buying a t-shirt is appreciated.

These are some of Saturday’s topics:

You can read the full program on the Drupalcamp website.

  • Published:May 23rd, 2013
  • Category:Drupal 8

Everything! Really!

Drupal 8 changes for developers

Everything will change and certainly for developers

  • The code will be more object oriented,
  • there will be a Symfony-like approach of theming (say goodbye to the _theme() hooks),
  • migrating from local to staging or a live-environment will be easier, as you will be able to save certain local settings in the code,
  • there’s the development project WSCCI (pronounced “Whiskey”) that will give devs the opportunity to write output for json, for apps, or for anything else besides html,
  • the multi-language-approach will be more logical and out of the box (Europe sighs).

In short… you probably won’t be able to reuse a single line of code from Drupal 7 to Drupal 8.

If you want to learn Drupal from scratch, you might want to wait till the release of 8 before you start to study.

Changes for users

For the users the changes are less dramatic, but there’s one big new feature:

  • In-place-editing, found in almost every commercial CMS will finally come to Drupal. This means that when you want to edit a text on a page, you don’t have to press the edit button, find the right field and save, but instead you’ll be able to change text within the normal website layout.

Still a lot of work

But… there’s still a lot of work. Drupal 8 is far from ready. The official release is planned towards the end of 2013, but the date march 2014 is probably more realistic. The in-place-editing for example is currently not working for the title-field, because the title is technically not a field. WSCCI is also far from ready.

Things are even so not-ready that some new features might be cut.


Those who want to contribute or want a sneak preview, can install D8 through GIT. Though, it’s not stable, not even in beta, so don’t use it in a live-environment.

$ git clone --branch 8.x

I upgraded my Ubuntu 10.04 to Linux Mint 14. After installing LAMP I got a Drupal WSOD on a previously well working site. As it turned out most errors came from deprecated php-functions and deprecated call by references to functions, introduced with the release of PHP 5.4.

At first I was a somewhat encouraged to solve those deprecated functions, but I gave up pretty soon. Drupal 6 isn’t designed for 5.4. Tweaking Drupal feels the same as upgrading to Drupal 7. Therefor, I keep it to PHP 5.3.

To downgrade 5.4 to 5.3 I recommend this script on the Ubuntu forums.

  • Published:March 14th, 2013
  • Category:Drupal 6

This post applies when

  • The admin menu suddenly disappears
  • The admin menu is incomplete (menu-items are missing)

Following scenario causes this behaviour:

  • The records of table “menu_links” with menu_name “admin_menu” were deleted (could be caused by an unfinished or erroneous cache wipe).
  • Cache-clear was called and caused a time-out by the webserver or php. (keep in mind cache-clear could’ve been called by cron through wget or by poormanscron)
  • Before the table menu_links was entirely refilled, a page of the website was requested by a user.

Even if you clear-cache afterwards, it says incomplete or missing.

A quick solution I’ve found is this:

  • Backup table “menu_links”
  • Delete the records in the table “menu_links” with menu_name = “admin_menu”. Don’t remove all the records in the table because primary and secondary links are also located in that table and they would be deleted permanently.DELETE FROM menu_links WHERE menu_name='admin_menu';
  • Call “cache-clear” but with Drush, because Drush doesn’t get interrupted by time-outs.

Or the more sustainable solution:

  • Change the time-out of the webserver to let’s say 120s.
  • Backup table “menu_links”
  • Delete the records in the table “menu_links” with menu_name = “admin_menu”. Don’t remove all the records in the table because primary and secondary links are also located in that table and they would be deleted permanently.DELETE FROM menu_links WHERE menu_name='admin_menu';
  • Call “cache-clear”, preferably with Drush, but you could also call it with the web admin as long as it doesn’t time-out.
Next Page » clearPaper by Copyright © 2012-2019 Robin Brackez. All rights reserved. By visiting this site you agree to accept cookies that are purely used to check how many visitors I have. Theme by: creativebits. Custom adaptations by Robin Brackez.