Set status to draft when copying record
This commit is contained in:
parent
91940f1e26
commit
0a0f553510
@ -7,6 +7,7 @@ use App\Entity\Collection;
|
|||||||
use App\Entity\Collector;
|
use App\Entity\Collector;
|
||||||
use App\Form\BibliographyType;
|
use App\Form\BibliographyType;
|
||||||
use App\Security\Voter\RecordVoter;
|
use App\Security\Voter\RecordVoter;
|
||||||
|
use App\RecordStatus;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@ -123,6 +124,7 @@ class BibliographyController extends AbstractController
|
|||||||
);
|
);
|
||||||
$copy->setCitation("{$bibliography->getCitation()} - Copy");
|
$copy->setCitation("{$bibliography->getCitation()} - Copy");
|
||||||
$copy->setModifiedAt(new DateTimeImmutable());
|
$copy->setModifiedAt(new DateTimeImmutable());
|
||||||
|
$copy->setStatus(RecordStatus::Draft->value);
|
||||||
|
|
||||||
$em->persist($copy);
|
$em->persist($copy);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
|||||||
use App\Entity\Collection;
|
use App\Entity\Collection;
|
||||||
use App\Entity\Bibliography;
|
use App\Entity\Bibliography;
|
||||||
use App\Entity\Collector;
|
use App\Entity\Collector;
|
||||||
|
use App\RecordStatus;
|
||||||
use App\Security\Voter\RecordVoter;
|
use App\Security\Voter\RecordVoter;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
@ -95,6 +96,7 @@ class CollectionController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
$copy->setTitle("{$collection->getTitle()} - Copy");
|
$copy->setTitle("{$collection->getTitle()} - Copy");
|
||||||
$copy->setModifiedAt(new \DateTimeImmutable());
|
$copy->setModifiedAt(new \DateTimeImmutable());
|
||||||
|
$copy->setStatus(RecordStatus::Draft->value);
|
||||||
|
|
||||||
$em->persist($copy);
|
$em->persist($copy);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user