Ticket #229 (closed defect: invalid)

Opened 7 months ago

Last modified 3 days ago

Attachment Query builder doesn't respect sitegroup constraints

Reported by: flack Assigned to: piotras
Priority: major Milestone: 8.09 Ragnaroek
Component: Midgard Core Version: 1.8 Thor
Keywords: Cc:

Description

If you do something like this f.x. in Style code (or in m.h.imagepopup):

$qb = new midgard_query_builder('midgard_attachment');
$qb->add_constraint('mimetype', 'LIKE', '%octet%');

var_dump($qb->execute());

Query Builder will return results from SG0

(tested in Midgard 1.8.7)

Change History

09/30/08 14:48:35 changed by bergie

  • milestone set to 1.8 Thor.

10/07/08 16:09:16 changed by bergie

  • version set to 1.8 Thor.
  • milestone changed from 1.8 Thor to 8.09 Ragnaroek.

Reassigning to Ragnaroek as that is now the stable branch.

10/09/08 10:41:06 changed by piotras

  • status changed from new to closed.
  • resolution set to invalid.

This is correct behaviour. QB implements fundamental Midgard rule which says that query returns objects in Sitegroup X *and* in sitegroup 0. You must add explicit sitegroup constraint in your case:

$qb->add_constraint("sitegroup", "=", $X);

Of course it's safe if you would like to query SG $Y objects while being in sg $X context.