Revision a06633f7
Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt
src/entitymanager.cpp | ||
---|---|---|
return list;
|
||
}
|
||
|
||
void EntityManager::manyToOne(const QSharedPointer<Entity> &entity, const QVariant &id, const QMetaProperty &property) {
|
||
qint64 convertedId = -1;
|
||
bool ok = false;
|
||
if((convertedId == id.toLongLong(&ok)) && ok && convertedId > -1) {
|
||
//property.t
|
||
}
|
||
}
|
||
|
||
void EntityManager::oneToMany(const QSharedPointer<Entity> &entity, const Relation &r, const QMetaProperty &property) {
|
||
|
||
}
|
||
|
||
void EntityManager::manyToMany(const QSharedPointer<Entity> &entity, const Relation &r, const QMetaProperty &property) {
|
||
|
||
}
|
||
|
||
void EntityManager::oneToOne(const QSharedPointer<Entity> &entity, const Relation &r, const QMetaProperty &property,
|
||
const QVariant &id) {
|
||
|
||
}
|
||
|
||
QList<QSharedPointer<Entity> > EntityManager::findEntityByAttributes(const QSharedPointer<Entity> &entity,
|
||
bool ignoreID) {
|
||
auto maps = this->findAllByAttributes(entity, ignoreID);
|
||
... | ... | |
return this->convertQueryResult(q);
|
||
}
|
||
|
||
void EntityManager::resolveRelations(const QSharedPointer<Entity> &entity, const QHash<QString, QVariant> &map) {
|
||
auto relations = entity.data()->getRelations();
|
||
auto props = entity.data()->getRelationProperties();
|
||
auto iterator = relations.constBegin();
|
||
while (iterator != relations.constEnd()) {
|
||
const Relation r = iterator.value();
|
||
const QMetaProperty property = props.value(r.getPropertyName());
|
||
switch (r.getType()) {
|
||
case MANY_TO_ONE:
|
||
if (map.contains(r.getPropertyName()) + "_id") {
|
||
this->manyToOne(entity, property.read(entity.data()), property);
|
||
}
|
||
break;
|
||
case MANY_TO_MANY:
|
||
this->manyToMany(entity, r, property);
|
||
break;
|
||
case ONE_TO_MANY:
|
||
this->oneToMany(entity, r, property);
|
||
break;
|
||
case ONE_TO_ONE:
|
||
this->oneToOne(entity, r, property, property.read(entity.data()));
|
||
break;
|
||
}
|
||
++iterator;
|
||
}
|
||
}
|
||
|
||
bool EntityManager::save(QSharedPointer<Entity> &entity) {
|
||
if (entity.data()->getId() > -1) {
|
||
return this->merge(entity);
|
Auch abrufbar als: Unified diff
wip