Completed
Push — Recipes ( c0466a...7632b6 )
by Laurent
04:22
created

ArticleController::removeArticleEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * ArticleController Controller of Article entity.
5
 *
6
 * PHP Version 7
7
 *
8
 * @author    Quétier Laurent <[email protected]>
9
 * @copyright 2018 Dev-Int GLSR
10
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version GIT: $Id$
13
 *
14
 * @see https://github.com/Dev-Int/glsr
15
 */
16
17
namespace App\Controller;
18
19
use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController as BaseAdminController;
20
use App\Entity\Settings\Article;
21
22
/**
23
 * Article Controller override EasyAdminBundle::AdminController.
24
 *
25
 * @category Controller
26
 */
27
class ArticleController extends BaseAdminController
28
{
29
    /**
30
     * Allows applications to modify the entity associated with the item being
31
     * edited before updating it.
32
     *
33
     * @param Article $article
34
     */
35
    public function updateArticleEntity(Article $article)
36
    {
37
        $article->setUpdateAt(new \DateTime());
38
        parent::updateEntity($article);
39
    }
40
41
    /**
42
     * Allows applications to modify the entity associated with the item being
43
     * deleted before removing it.
44
     *
45
     * @param Article $article
46
     */
47
    protected function removeArticleEntity(Article $article)
48
    {
49
        $article->setUpdateAt(new \DateTime());
50
        $article->setDeleteAt(new \DateTime());
51
        $article->setActive(false);
52
        $this->em->persist($article);
0 ignored issues
show
Bug introduced by
The method persist() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
        $this->em->/** @scrutinizer ignore-call */ 
53
                   persist($article);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
        $this->em->flush();
54
    }
55
}
56