Created
January 9, 2013 20:13
-
-
Save Fi1osof/4496395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$modx->setLogTarget('HTML'); | |
print '<pre>'; | |
$topic = $modx->modblog->getTopic(289); | |
$blogs = $modx->modblog->getBlogs(); // Получаем все блоги | |
$blogtopics = array(); | |
foreach($blogs as $blog){ | |
// Создаем объект Топик-Блог (еще не сохраняем) | |
$tb = $modx->newObject('SocietyBlogTopic'); | |
$tb->addOne($blog); | |
$blogtopics[] = $tb; | |
} | |
// Добавляем к топику все связки Топик-Блог (еще не сохраненные) | |
$topic->addMany($blogtopics); | |
// Сохраняет все связки, которых еще не существует | |
$topic->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment