Search

Hi, I’m fighting with writing my own extension. One part of it is displaying entries exactly in the same way as symphony does in a content.publish.php (with some bonuses from me). I removed pagination and ordering because they are not necessary for now and make my code much more complicated. But I encountered an issue I can’t figure out, namely section_associations table in my database and pieces of code in content.publish.php related to it (__viewIndex function):

            $child_sections = NULL;

        $associated_sections = $section->fetchAssociatedSections();
        if(is_array($associated_sections) && !empty($associated_sections)){
            $child_sections = array();
            foreach($associated_sections as $key => $as){
                $child_sections[$key] = $sectionManager->fetch($as['child_section_id']);
                $aTableHead[] = array($child_sections[$key]->get('name'), 'col');
            }
        }

What this is for?

Section association is a way for the system to know if it needs to create a column with a entry count and link to the associated section. You see these columns when you have a section link field linking to another section.

Sorry, but I still don’t get the point :) Could you give me some teenie-tiny example of when should I use it?

Does this thread explain it any better: Core: Section Associations?

There are a small handful of fields that use the Associated Sections concept, the most common being the Select Box Link. When you link two sections together using this field, Symphony tracks this relationship in the associations database table. When it comes to render the entry table it looks for any relationships that this sections is a part of, and creates a column for each (each cell is a hyperlinked number of the total related entries, linking to the related section).

Okay, it’s clear now.

I had a feeling that I’m implementing something similar and it was a good feeling :) THANKS!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details