Answer the question
In order to leave comments, you need to log in
How to draw up a diagram for the model and use it?
There are two models: forum section and forum topic.
You need to display a list of recent topics.
Partition scheme:
<object class="ForumSections" table="forum_sections" extends="xPDOSimpleObject">
<field key="title" dbtype="varchar" precision="32" phptype="string" null="false" />
<field key="alias" dbtype="varchar" precision="16" phptype="string" null="false" />
</object>
<object class="ForumTopics" table="forum_topics" extends="xPDOSimpleObject">
<field key="section" dbtype="tinyint" precision="3" attributes="unsigned" phptype="integer" null="false" />
<field key="author" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" />
<field key="title" dbtype="varchar" precision="255" phptype="string" null="false" />
</object>
SELECT * FROM `modx_forum_topics` JOIN `modx_forum_sections` ON `modx_forum_topics`.`section` = `modx_forum_sections`.`id`
Answer the question
In order to leave comments, you need to log in
On a good note, links (composite or aggregate) need to be added to the schema. Then generate automatically or manually map files. After that, objects can be obtained like this:
$TopicSection= $xpdo->getObject('TopicSection',$id);
$Topics= $TopicSection->getMany('Topics');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question