Project

General

Profile

Actions

Feature #882

closed

method of dbo::collection to test whether object belongs to collection

Added by Boris Nagaev almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
06/30/2011
Due date:
% Done:

0%

Estimated time:

Description

Hello!

Could you provide method of dbo::collection to test whether object belongs to collection?

Currently only way to do it is using of collection.find:

    if(p->tags.find().where("id = ?").bind(cooking.id()).resultList().size() == 1)

It can be replaced with

    if(p->tags.has(cooking))
Actions #1

Updated by Boris Nagaev almost 13 years ago

Sorry, it is not a bug, but a feature :)

Actions #2

Updated by Koen Deforche almost 13 years ago

  • Assignee set to Koen Deforche

Hey Starius,

A great feature!

To be STL compliant, that would need to be either (or both):

  p->tags.count(cooking) == 1

or

  p->tags.find(cooking) != p->tags.end();

A feature request always feels like a great excuse to work on nifty dbo !

Regards,

koen

Actions #3

Updated by Koen Deforche almost 13 years ago

  • Tracker changed from Bug to Feature
Actions #4

Updated by Koen Deforche almost 13 years ago

  • Status changed from New to Resolved
  • Target version set to 3.1.11

I've implemented this syntax:

  p->tags.count(cooking) == 1

It also takes into account natural (and composite IDs).

Regards,

koen

Actions #5

Updated by Koen Deforche over 12 years ago

  • Status changed from Resolved to Closed

Resolved in Wt 3.1.11

Actions

Also available in: Atom PDF