Herunterladen als
root/samples/simple/group.cpp @ 6734364c
59e17af2 | SebastianDiel | #include "group.h"
|
|
#include "../samples/example/models/pupil.h"
|
|||
#include <QDebug>
|
|||
Group::Group() : Entity() {
|
|||
}
|
|||
const QHash<QString, CuteEntityManager::Relation> Group::getRelations() const {
|
|||
auto hash = QHash<QString, CuteEntityManager::Relation>();
|
|||
hash.insert("persons", CuteEntityManager::Relation("persons",
|
|||
6734364c | Christian Ehringfeld | RelationType::MANY_TO_MANY));
|
|
hash.insert("pupils", CuteEntityManager::Relation("pupils",
|
|||
59e17af2 | SebastianDiel | RelationType::MANY_TO_MANY, QString("groups")));
|
|
hash.insert("mainTeacher", CuteEntityManager::Relation("mainTeacher",
|
|||
RelationType::MANY_TO_ONE));
|
|||
return hash;
|
|||
}
|
|||
QString Group::getName() const {
|
|||
return name;
|
|||
}
|
|||
void Group::setName(const QString &value) {
|
|||
name = value;
|
|||
}
|
|||
6734364c | Christian Ehringfeld | QList<QSharedPointer<Pupil> > Group::getPupils() const {
|
|
return pupils;
|
|||
}
|
|||
void Group::setPupils(const QList<QSharedPointer<Pupil> > &value) {
|
|||
pupils = value;
|
|||
}
|
|||
void Group::addPupil(Pupil *pupil) {
|
|||
this->pupils.append(QSharedPointer<Pupil>(pupil));
|
|||
}
|
|||
QSharedPointer<Pupil> Group::pupilAt(int i) {
|
|||
return this->pupils.at(i);
|
|||
}
|
|||
59e17af2 | SebastianDiel | ||
QSharedPointer<Person> Group::getMainTeacher() const {
|
|||
return mainTeacher;
|
|||
}
|
|||
void Group::setMainTeacher(const QSharedPointer<Person> &value) {
|
|||
mainTeacher = value;
|
|||
}
|
|||
QList<QSharedPointer<Person> > Group::getPersons() const {
|
|||
return persons;
|
|||
}
|
|||
8f029876 | Christian Ehringfeld | void Group::addPerson(Person *person) {
|
|
this->persons.append(QSharedPointer<Person>(person));
|
|||
59e17af2 | SebastianDiel | }
|
|
void Group::setPersons(const QList<QSharedPointer<Person> > &value) {
|
|||
persons = value;
|
|||
}
|
|||