Pimcore: Data management made easy

Do you know the problem? In most cases, your own application not only has to map your own business logic, but also requires a backend with user interface for Data management. Programming a nice, efficient and easy-to-use UI is not an easy task. The Pimcore system offers an interesting approach.

What options are there in general for maintaining data in a backend? Of course, the most obvious approach is to fully develop even an appropriate interface, but to simplify this through scaffolding or form bundles. Often, however, this is (still) a big hassle and / or leads to interfaces that are not well-to-use for users.

An alternative is to use an existing system. For example, content management systems (CMS) such as WordPress, Typo3 or Drupal can be expanded with their own data structures. However, these systems are often not very flexible in terms of mapping more complex data structures. In addition, they usually can not handle large amounts of data with high performance. By contrast, Product Information Management (PIM) systems are well-suited to these tasks, but only if they are pure product data. In the open source area, the choice of available systems is also very manageable; Akeneo is a popular example here.

But what if your own data structures become more complex?

This is where Pimcore comes into play. As the name implies, Pimcore was originally intended to manage product data, but with its highly flexible data structures, it can serve virtually any usage scenario – Pimcore goes far beyond PIM. It is a master data management system, MDM for short.

As an open source (GPLv3) project, it is available on GitHub and is easily installed through Composer and Packagist:

COMPOSER_MEMORY_LIMIT=3G composer create-project pimcore/skeleton my-project

Directly after installation on a web server you can call the user interface via a browser. The GUI is based on the Sencha ExtJS6 toolkit and thus supports many convenient interaction options – in particular, drag and drop of data is possible everywhere.

Pimcore itself sees itself as a platform – it is not a “ready” system that can be used directly – as a developer, however, you can quickly and easily adapt it to your own needs.
How does the data management with Pimcore work now? Rather than defining data structures in code or annotation, as is typically done with database abstraction layers or Object Relational Mappers (ORM) such as: As Doctrine does, Pimcore chooses a visual approach. In the Pimcore backend there is the concept of object classes. An object class defines both the physical data schema in the database – Pimcore works exclusively with MySQL or MariaDB – as well as the input forms or forms for data processing by the user.

You add data fields and properties of the object class. In the background, Pimcore not only automatically changes the database structures via data schema migrations, but also generates the backend UI for the user as well as PHP code to programmatically access the data via ORM.

This feature taken for itself is not spectacular yet – what is z. Eg already a simple VARCHAR field in a table with associated INPUT form field? Interestingly, Pimcore is interesting because a large number (over 40) of available field and data types make it possible to model complex data structures. Thus, there are also attributable m: n-link field types. This can be z. B Structures such as object class 1 “Person”, object class 2 “Company”, Relations field in “Company”: “Employee” with the additional attribute “Role: CTO”. There are also data field types for image links (with drag and drop and upload within the interface), geo-coordinates or geo-surfaces (with Google Maps integration for data manipulation) – a list can be found in Table 1.

Basic field type Description
input, textarea, wysiwyg Editing texts and strings, HTML
numeric, slider, quantityvalue Numerical values
date, time, datetime Date and Time
select, multiselect, country, user Drop-down. Selection fields, some with data
Href, multihref, objects, metadata Link types for objects, assets and documents
block Groups other field types and allows repeats
classification store Sets of attributes, groupable
table, sturctured table Tabular, simple data
field collections Lists of attributes
image, gallery, video Special links to pictures and videos, incl. Metadata
localized fields Groups other fields for multilingualism
geographic Geocoordinates, surfaces

 

In the visual object class definition editor, however, you can specify not only the data structure but also the layout of the editing forms. Again, Pimcore provides a range of typical containers and visual design options such as panels, accordions or tablayouts. Fields and containers can be placed next to each other or interleaved. Images 1 and 2 show a simple object class for blog articles.

Pimcore visual data structure Pimcore simple edit form

You can now create several processing forms for a database schema. For example, to allow different users and roles different views and permissions at the field level for editing – details can be found in the Pimcore documentation under the keyword ” Custom Views “.

Each record, that is, each instance of an object class, is stored by Pimcore in the MySQL database. For organization and administration one sets for each entry a symbolic name as a key. Furthermore, Pimcore knows a hierarchical relationship between the data sets, by means of which tree structures can be mapped directly with the data or virtual directories ( Image 3 ).

Pimcore visual tree

Another big strength of Pimcore is the ability to manage variants of records. For this purpose, the field properties of an object are automatically inherited to the child child elements. h., If z. For example, if you change the name of a product object, this change is immediately visible in all variants. If a variant should get a different, specific name, you just overwrite it there.

Through this concept, Pimcore is not limited to a certain number of dimensions for variants, as is often the case in other systems.

Of course, for a data management system: Of course, Pimcore knows the concept of versioning with any number of steps in the past and also has a recycle bin, from which deleted objects can be restored. As a special feature, however, you can also edit records and then publish the version at a later date. Each change is assigned to the current user and can be visually compared.

So far, it is not necessary to write a single line of code. Other basic functions such as configurable list views, CSV imports and exports as well as tools such as XLIFF translation management work directly from the standard installation. However, as soon as third-party systems are to be connected, it makes sense to develop their own APIs. Although Pimcore has a generic REST API, which in principle can be used directly for data exchange – due to the high flexibility of the data structures, it is usually easier to adapt Pimcore to the external systems instead of implementing the Pimcore REST interface in a third party system.

How do you work with the data in the code?

As we mentioned in the beginning, Pimcore automatically generates an ORM as PHP code. This PHP API provides all functions to comfortably access the data. Here in Listing 1 a few simple examples – in the Pimcore documentation you will find everything else.

[cc lang=”javascript”]$newObject = new DataObject\Myclassname();$newObject->setKey(‘new-object’);$newObject->setParentId(1); $newObject->setName(“New Name”);$newObject->setDescription(“Some Text”);$newObject->save()$myObject = DataObject::getByPath(“/new-object”);echo $myObject->getName();[/cc]

In most cases, the requirements for data management are not limited to pure data, but often binary data such as images, PDFs or office documents must be managed. Pimcore also provides functions with its DAM (Digital Asset Management). It can, with the help of various open-source tools, generate thumbnails of almost all file types, images, documents and videos. This image processing is not only built into the system, but can also be defined by the user as a complex image processing process and used later in the code. In addition to the traditional crop, size and color manipulation options, there are also functions for embedding watermarks or automatic recognition of focus points (eg faces).

The assets can then not only be simply dragged and dropped into the data objects, but also receive metadata in addition to the IPTC and EXIF ​​standards. B. by linking with data objects.

In addition to the possibilities for data and asset management, Pimcore also offers further functions for playing out. Fortunately, the wheel was not reinvented – Pimcore is based on symfony and follows the (M) VC approach with controllers, actions, and twig templates.

A “document” in Pimcore can be a page of a web page, but also a newsletter or part of a print document – typically HTML. Documents are created in the Pimcore backend similar to objects and assets in a tree structure. The documents can then be assigned specific controllers, actions and templates.

In addition to the classic method of transferring data in the action method of the controller into the view, ie the template, Pimcore knows the concept of the so-called Editables. To do this, insert code into the templates and then receive corresponding form elements in the backend in the edit mode. If, on the other hand, the document is rendered in the frontend, the contents come to the fore. Listing 2 shows a simple example of a twig template with placeholders for image and text.

[cc lang=”javascript”]< h1 >{{ pimcore_input(“title text”) }}< /h1 > < div >{{ pimcore_image(“article image”) }}< /div >[/cc]

This is just a simple example when it comes to document creation – in addition to elements, Pimcore can also handle renderlets. It can then drag and drop entire objects into a document, are linked and presented according to the specifications of the developer – always with the latest data from the object.

The features and concepts presented so far only scratch the surface of what is possible with Pimcore, and what functionalities are still hidden in the platform. At this point is z. For example, we highlight the Analytics integration with Matomo / Piwik, comprehensive content personalization and marketing automation capabilities, CRM and a complete e-commerce framework.

When should one not use Pimcore?

Of course, the many possibilities that Pimcore provides in data manipulation and the PHP API have their price: If you often do batch operation on millions of data sets, then it’s typically more efficient to do them directly on MySQL. Also, establishing a customized system requires solid PHP and DevOps know-how; the learning curve is probably quite steep for PHP beginners. In addition, Pimcore relies on code generation for a POSIX file system – the ability to deploy scalable and highly available operations on Docker containers, such as docking containers. B. over Kubernetes is relatively expensive. However, this feature shares Pimcore with almost all major data and content management systems.

Conclusion

Pimcore is a powerful platform that allows developers to quickly and easily model basic data structures. Immediately there is a comprehensive interface for the users, with which data can be processed quickly and comfortably. In order to expand the system and adapt it to specific requirements, it is not necessary to learn complex new concepts. Pimcore builds on standards in PHP development and provides helpful tools for the implementer. Last but not least: Developing with Pimcore is fun!

Recent Articles

spot_img

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here