function getLessonsDatas($lessons_ids = []) { $lessons_objects = LessonQuery::create()->_if(count($lessons_ids))->filterByPrimaryKeys($lessons_ids)->_endif()->find(); $lessons_datas = []; foreach ($lessons_objects as $lesson_object) { $lessons_datas[$lesson_object->getId()] = $lesson_object->toArray(); } return $lessons_datas; }
<?php require_once '../vendor/autoload.php'; require_once '../generated-conf/config.php'; require_once '../app/functions/functions.php'; $root_lesson = LessonQuery::create()->findRoot(); foreach ($root_lesson->getBranch() as $node) { echo str_repeat('- ', $node->getLevel()) . $node->getTitle() . "\n"; }
<?php require_once '../vendor/autoload.php'; require_once '../generated-conf/config.php'; require_once '../app/functions/functions.php'; $root_lesson_object = LessonQuery::create()->findRoot(); if (!$root_lesson_object) { $root_lesson_object = new Lesson(); $root_lesson_object->setSummary('Lessons')->makeRoot()->save(); }