26 lines
497 B
C++
26 lines
497 B
C++
#ifndef __TAG_H__
|
|
#define __TAG_H__
|
|
|
|
#include <Wt/Dbo/Types.h>
|
|
|
|
class Post;
|
|
using Posts= Wt::Dbo::collection<Wt::Dbo::ptr<Post>> ;
|
|
|
|
class Tag {
|
|
public:
|
|
Tag() = default;
|
|
Tag(const std::string &aName) : name(aName) {
|
|
}
|
|
template <class Action>
|
|
void persist(Action &a) {
|
|
Wt::Dbo::field(a, name, "name");
|
|
|
|
Wt::Dbo::hasMany(a, posts, Wt::Dbo::ManyToMany, "post_tag");
|
|
}
|
|
|
|
std::string name;
|
|
Posts posts;
|
|
};
|
|
|
|
DBO_EXTERN_TEMPLATES(Tag)
|
|
#endif // __TAG_H__
|