-
Notifications
You must be signed in to change notification settings - Fork 452
/
OneAssociationSaveHandler.php
37 lines (31 loc) · 1.19 KB
/
OneAssociationSaveHandler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Concrete\Core\Express\Form\Control\SaveHandler;
use Concrete\Core\Entity\Express\Control\AssociationControl;
use Concrete\Core\Entity\Express\Control\Control;
use Concrete\Core\Entity\Express\Entry;
use Concrete\Core\Express\Association\Applier;
use Concrete\Core\Express\ObjectAssociationBuilder;
use Concrete\Core\Express\ObjectManager;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Builder\AssociationBuilder;
use Symfony\Component\HttpFoundation\Request;
abstract class OneAssociationSaveHandler implements SaveHandlerInterface
{
protected $entityManager;
protected $applier;
public function __construct(Applier $applier, EntityManager $manager)
{
$this->entityManager = $manager;
$this->applier = $applier;
}
protected function getAssociatedEntryFromRequest(Control $control, Request $request)
{
/**
* @var $control AssociationControl
*/
$r = $this->entityManager->getRepository('Concrete\Core\Entity\Express\Entry');
$entryID = $request->request->get('express_association_' . $control->getId());
$associatedEntry = $r->findOneById($entryID);
return $associatedEntry;
}
}