MgdSchema method list
Description:
$object->list(void)
Minimum version: Midgard 1.7
Returns new MidgardQueryBuilder object.
MidgardQueryBuilder's execute method returns objects of the same type which upfield value points to object's primary property.
<?php
$object = new midgard_article();
$object->get_by_id(123);
$qb = $object->list();
$qb->add_constraint("created",">", "20050601");
$qb->execute();
?>
Return false when new Query Builder object can not be created.
Follow mgd_errstr() function to get error message on failure.
Midgard 1.8
array $object->list(void)
Since Midgard 1.8 this function returns array of objects which are the same type as object's instance for which this method was called. All objects are returned unconditionaly. You should use MidgardQueryBuilder, if you want to add some particular constraints.
An empty array will be returned if object's type has no up attribute
defined in schema XML files, or if there are no objects' records in database.
<?php
$object = new midgard_article();
$object->get_by_id(123);
$array = $object->list();
if($array) {
$n = count($array);
echo "<b> $n </b> objects listed for $object->name";
}
?>
