-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathUpdateGuesser.php
40 lines (35 loc) · 945 Bytes
/
UpdateGuesser.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
38
39
40
<?php
namespace Pim\Bundle\CustomEntityBundle\Versioning;
use Akeneo\Tool\Bundle\VersioningBundle\UpdateGuesser\UpdateGuesserInterface;
use Doctrine\ORM\EntityManager;
/**
* Custom entity update guesser
*
* @author Nicolas Dupont <nicolas@akeneo.com>
* @copyright 2013 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class UpdateGuesser implements UpdateGuesserInterface
{
/**
* {@inheritdoc}
*/
public function supportAction($action)
{
return in_array(
$action,
[UpdateGuesserInterface::ACTION_UPDATE_ENTITY]
);
}
/**
* {@inheritdoc}
*/
public function guessUpdates(EntityManager $em, $entity, $action)
{
$pendings = [];
if ($entity instanceof VersionableInterface) {
$pendings[] = $entity;
}
return $pendings;
}
}