You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query Builder is a feature in the Midgard which is used to run database queries. It only works with data structures based on MgdSchema.
In MidCOM, Query Builder functionality is available to [DBA classes](MidCOM DBA) in the new_query_builder() method, while the class midcom_helper__dbfactory (accessible via the midcom accessor) allows for generic access.
Query Builder always returns MgdSchema objects. If only specific bits of information are needed, Midgard Collector can be used instead.
// Instantiate Query Builder for an article object$qb = newmidgard_query_builder('midgard_article');
// List articles only in topic 123$qb->add_constraint('topic', '=', 123);
// Run the query$articles = $qb->execute();
// Show the articlesforeach ($articlesas$article)
{
echo$article->title . "<br />\n";
}