コード例 #1
0
ファイル: add_topic.php プロジェクト: arneau/defender-app
<?php

require_once '../vendor/autoload.php';
require_once '../generated-conf/config.php';
require_once '../app/functions/functions.php';
$root_topic = TopicQuery::create()->findRoot();
if (!$root_topic) {
    $root_topic = new Topic();
    $root_topic->setName('Topics')->makeRoot()->save();
}
コード例 #2
0
ファイル: topics.php プロジェクト: arneau/defender-app
function getTopicsDatas($topics_ids = [])
{
    $topics_objects = TopicQuery::create()->_if(count($topics_ids))->filterByPrimaryKeys($topics_ids)->_endif()->find();
    $topics_datas = [];
    foreach ($topics_objects as $topic_object) {
        $topics_datas[$topic_object->getId()] = $topic_object->toArray();
    }
    return $topics_datas;
}