Revert sprememb, reseno na drugem branchu
parent
9e81be6be2
commit
9d50577f51
|
@ -90,11 +90,11 @@ class AddConcept extends ResourceBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ustvari nov ali uredi obstoječ koncept.
|
* Ustvari nov koncept.
|
||||||
*
|
*
|
||||||
* Logika:
|
* Logika:
|
||||||
* 1. Zloadamo uporabnika preko emaila, ce ne obstaja, ga ustvarimo.
|
* 1. Zloadamo uporabnika preko emaila, ce ne obstaja, ga ustvarimo.
|
||||||
* 2. Zloadamo koncept prek uuid, ce ne obstaja, ga ustvarimo.
|
* 2. Zloadamo koncept prek uuid, ce ne obstaja, da ustvarimo.
|
||||||
* - avtor je zloadan prek maila
|
* - avtor je zloadan prek maila
|
||||||
*
|
*
|
||||||
* @param \Symfony\Component\HttpFoundation\Request;
|
* @param \Symfony\Component\HttpFoundation\Request;
|
||||||
|
@ -117,14 +117,11 @@ class AddConcept extends ResourceBase {
|
||||||
throw new MissingDataException('Title, uuid or text missing.');
|
throw new MissingDataException('Title, uuid or text missing.');
|
||||||
}
|
}
|
||||||
$uid = $this->getUserIdByEmail($data['email'] ?? null);
|
$uid = $this->getUserIdByEmail($data['email'] ?? null);
|
||||||
// @TODO - loudaj zadnjo revizijo in primerjaj z entiteto, je
|
|
||||||
// razlika?
|
|
||||||
// Kako dodati revizijo, ki je draft?
|
|
||||||
if ($concept = $this->getConceptFromUuid($data['uuid'])) {
|
if ($concept = $this->getConceptFromUuid($data['uuid'])) {
|
||||||
// Concept exists - create a new revision.
|
// Concept exists - create a new revision.
|
||||||
$oldConcept = clone $concept;
|
|
||||||
|
|
||||||
$concept->setNewRevision(TRUE);
|
$concept->setNewRevision(TRUE);
|
||||||
|
$concept->setRevisionUserId($uid);
|
||||||
|
$concept->setRevisionCreationTime(\Drupal::time()->getRequestTime());
|
||||||
$concept->set('title', $data['title']);
|
$concept->set('title', $data['title']);
|
||||||
$concept->set('body', $data['text'] ?? $concept->body->value);
|
$concept->set('body', $data['text'] ?? $concept->body->value);
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
|
@ -142,12 +139,8 @@ class AddConcept extends ResourceBase {
|
||||||
'@revid' => $concept->getRevisionId(),
|
'@revid' => $concept->getRevisionId(),
|
||||||
'@uid' => $uid,
|
'@uid' => $uid,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
/*
|
else {
|
||||||
$oldConcept->isDefaultRevision(TRUE);
|
|
||||||
$oldConcept->save();
|
|
||||||
*/
|
|
||||||
} else {
|
|
||||||
// Concept does not exist - create a new node.
|
// Concept does not exist - create a new node.
|
||||||
$concept = [
|
$concept = [
|
||||||
'type' => 'concept',
|
'type' => 'concept',
|
||||||
|
|
Loading…
Reference in New Issue