As you already know, SEBLOD is a powerful tool to build high-end websites and online applications using mostly user interfaces.
From content construction, content filling, to content output, there is always a dedicated user interface to gives us the ability to build applications only with parameters, drag & drops, various setups and out-of-the-box capabilities.

Of course sometimes for a specific workflow, advanced uses-cases, or complex interactions, we need to manipulate Content Items such as Articles, Categories, Users... programatically!

Joomla! already provides various ways of manipulating content :

  • Database abstraction layer for custom SQL queries
  • JTableContent
  • ...

but with SEBLOD, you data is stored in different tables, and it becomes quite complex to interact with all these tables.

JCckContent, our in-house "ORM"

So we needed our own, more specific and more advanced way of doing it, and here is JCckContent !

JCckContent is the main class, and each Object provides its own subclass such as:

  • JCckContentArticle
  • JCckContentCategory
  • JCckContentUser
  • JCckContentUserGroup
  • JCckContentUserNote
  • ...

Its purpose is to abstract as much as possible all actions related to Content manipulation:

  • Being able to create an item without executing multiple INSERT queries.
  • Being able to load an item or find items without writing a complex SELECT query.
  • Being able to manipulate an item as a "whole".

One more thing

A JCckContent object consists in multiple table instances where each refers to a specific table.
As an example, here is the list of table instances for a Content Type: "Blog Post" (blog_post), based on the Joomla! Article object:

  • "base" relates to #__content
  • "core" relates to #__cck_core
  • "more" relates to #__cck_store_form_blog_post
  • "more2" relates to #__cck_store_item_content

A Content Item has 2 identifiers:

  • the Primary Key, i.e the primary key of the "base" table, that we'll call $pk
  • the SEBLOD IDentifier, i.e. the primary key of the "core" table, that we'll call $id

Additional note: $pk can only be used to identify a Content Item when the Object is known (or passed along).

Now let's find out how to create, load, find/search, delete, save, or interact with Content Items easily !