Item Association - "key" field in #__associations? - Joomla! Forum - community, help and support


the multilanguage item association in joomla 3.0.2 awesome!
the description @ http://community.joomla.org/blogs/commu ... s-new.html extensive.

however, can't find technical information how #__associations + "key" field work. e.g. have 3 content items:

code: select all

insert `jos_content` values(1, 37, 'testing', 'testing', '<p>one 2 three</p>', '', 1, 8, '2012-12-10 06:58:24', 856, [..] 1, 'en-gb', '');
insert `jos_content` values(2, 38, 'testen', 'testen', '<p>een twee drie</p>', '', 1, 9, '2012-12-10 06:58:43', 856, [..] 1, 'nl-nl', '');
insert `jos_content` values(6, 43, 'test', 'test', '<p>un deux trois</p>', '', 1, 10, '2012-12-10 15:55:43', 856, [..] 0, 'fr-fr', '');

associated each other, , #__associations contains:

code: select all

id, context, key
1, com_content.item, 299772356e624c6858d75ddc57a06f0e
2, com_content.item, 299772356e624c6858d75ddc57a06f0e
6, com_content.item, 299772356e624c6858d75ddc57a06f0e

i noticed "key" field created upon saving via /administrator/components/com_content/models/article.php.
between line 441 - 498 says:

code: select all

                if (!$all_language && count($associations)) {
                    // adding new association these items
                    $key = md5(json_encode($associations));
                    $query->clear();
                    $query->insert('#__associations');
                    foreach ($associations $tag => $id) {
                        $query->values($id.','.$db->quote('com_content.item') . ',' . $db->quote($key));

                    }
                    $db->setquery($query);
                    $db->execute();


my questions:
1. can point me technical documentation item association?
2. how concept of item association work "key" fields?
3. why associations stored md5?
4. sql statement use create associations directly in database using phpmyadmin?

thanks in advance!

pe7er wrote:my questions:
1. can point me technical documentation item association?

see google groups mailing list "joomla! general development":
https://groups.google.com/group/joomla- ... b69fef6aa5

pe7er wrote:2. how concept of item association work "key" fields?

the #__associations keeps track of sort of associations.
the "id" field *not* autoincrement.
the "context" refers table of content used associations.
e.g. records in #__content referenced "com_content.item"
the "key" field = md5 hash.

records same context + same key associated together.
pe7er wrote:3. why associations stored md5?

because not matter "key" used,
only items same context + same key associated together.

pe7er wrote:4. sql statement use create associations directly in database using phpmyadmin?


i have 3 records in jos_content belong together. ids + languages are:
id: 4070 = en, 4071 = fr , 4072 = pt.
with following query (notice: 1234567890abcdef1234567890abcdef = random) able associate them via phpmyadmin:

code: select all

insert `jos_associations` values('4070', 'com_content.item', '1234567890abcdef1234567890abcdef');
insert `jos_associations` values('4071', 'com_content.item', '1234567890abcdef1234567890abcdef');
insert `jos_associations` values('4072', 'com_content.item', '1234567890abcdef1234567890abcdef');





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support