Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added generic part to NSDictionary declaration. It's correct in the package-level Javadocs.

...

Code Block
ERTaggableEntity.registerTaggable(Person.ENTITY_NAME);

Add convenience methods onto your Person class (optional, but handy):

...

Code Block
Person mike = Person.createPerson(editingContext, "Mike Schrag");
ERTaggable taggableMike = mike.taggable();
taggableMike.addTags("mike employee important");

NSArray matchingPeople = Person.taggableEntity().fetchTaggedWith("employee", editingContext);
	
NSDictionary>
NSDictionary<EOEntity, NSArray<? extends ERXGenericRecord>> matchingItems = ERTaggableEntity.fetchAllTaggedWith("mike", editingContext);

...

Code Block
public class TagNormalizer implements ERTagNormalizer {
  public String normalize(String tag) {
	
    String normalizedTag = tag;
    if (normalizedTag != null) {
      normalizedTag = normalizedTag.trim();
    }
    return normalizedTag;
  }
}

...

Wiki Markup
If you don't want to use the migration, you need to create a join table that contains a "your entity id" (named item_\[WONDER:your pk column name\] for each pk attribute) and an ERTagID foreign key (named tag_id). You can name the columns whatever you want if you also manually create the join entity in your EOModel.