Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f27ac316

Von Christian Ehringfeld vor etwa 9 Jahren hinzugefügt

  • ID f27ac316d0c316b92cc9f8373fae4214e7a9c92e
  • Vorgänger bb0340b7
  • Nachfolger ea09b5be

small cleanup

Unterschiede anzeigen:

src/entitymanager.cpp
auto e = EntityInstanceFactory::castQVariant(var);
this->saveObject(e, mergedObjects, true, ignoreHasChanged);
auto prop = EntityHelper::mappedProperty(r, e);
if (prop.isValid()) {
EntityHelper::setProperty(e, entity, prop);
}
EntityHelper::setProperty(e, entity, prop);
}
}
++iterator;
......
void EntityManager::savePostPersistedRelations(const QSharedPointer<Entity>
&entity, QList<Entity *> &mergedObjects, bool ignoreHasChanged) {
auto relations = EntityHelper::getRelationProperties(entity.data());
for (auto iterator = relations.constBegin(); iterator != relations.constEnd();
++iterator) {
const Relation r = iterator.key();
auto var = iterator.value().read(entity.data());
for (auto i = relations.constBegin(); i != relations.constEnd(); ++i) {
const Relation r = i.key();
auto var = i.value().read(entity.data());
if (!var.isNull()) {
if (r.getType() == RelationType::MANY_TO_MANY) {
this->persistManyToMany(entity, r, var, mergedObjects, ignoreHasChanged);
......
for (int var = 0; var < list.size(); ++var) {
auto e = list.at(var);
if (this->shouldBeSaved(e, r)) {
if (fkProp.isValid()) {
EntityHelper::setProperty(e, entity, fkProp);
}
EntityHelper::setProperty(e, entity, fkProp);
this->saveObject(e, mergedObjects, true, ignoreHasChanged);
}
}
......
&& !r.getMappedBy().isEmpty()) {
auto e = EntityInstanceFactory::castQVariant(var);
auto fkProp = EntityHelper::mappedProperty(r, e);
if (fkProp.isValid()) {
EntityHelper::setProperty(e, entity, fkProp);
}
EntityHelper::setProperty(e, entity, fkProp);
this->saveObject(e, mergedObjects, true, ignoreHasChanged);
}
......
void EntityManager::removeRelations(const QSharedPointer<Entity> &entity) {
auto props = EntityHelper::getRelationProperties(entity.data());
auto iterator = props.constBegin();
while (iterator != props.constEnd()) {
const Relation r = iterator.key();
auto property = iterator.value();
for (auto i = props.constBegin(); i != props.constEnd(); ++i) {
const Relation r = i.key();
auto property = i.value();
auto var = property.read(entity.data());
if (r.getType() == RelationType::MANY_TO_MANY) {
this->removeManyToManyEntityList(entity, r, var);
......
|| r.getType() == RelationType::MANY_TO_ONE) {
this->setNullEntityPropertyRelation(var, r);
}
++iterator;
}
}

Auch abrufbar als: Unified diff