public function getAssociations($post_id = null)
    {
        $oConfig       = Factory::service('Config');
        $oDb           = Factory::service('Database');
        $_associations = $oConfig->item('blog_post_associations');

        if (!$_associations) {
            return array();
        }

        // --------------------------------------------------------------------------

        foreach ($_associations as &$assoc) {

            /**
             * Fetch the association data from the source, fail ungracefully - the dev
             * should have this configured correctly.
             *
             * Fetch current associations if a post_id has been supplied
             */

            if ($post_id) {

                $oDb->where('post_id', $post_id);
                $assoc->current = $oDb->get($assoc->target)->result();

            } else {

                $assoc->current = array();
            }

            //  Fetch the raw data
            $oDb->select($assoc->source->id . ' id, ' . $assoc->source->label . ' label');
            $oDb->order_by('label');

            if (isset($assoc->source->where) && $assoc->source->where) {

                $oDb->where($assoc->source->where);
            }

            $assoc->data = $oDb->get($assoc->source->table)->result();
        }

        return $_associations;
    }