Completed
Pull Request — 5.0 (#2162)
by Kevin
14:33
created

MediaPagePartBundle/Entity/DownloadPagePart.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace  Kunstmaan\MediaPagePartBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
use Kunstmaan\MediaBundle\Entity\Media;
8
use Kunstmaan\MediaPagePartBundle\Form\DownloadPagePartAdminType;
9
use Kunstmaan\PagePartBundle\Entity\AbstractPagePart;
10
11
/**
12
 * DownloadPagePart
13
 *
14
 * @ORM\Entity
15
 * @ORM\Table(name="kuma_download_page_parts")
16
 */
17 View Code Duplication
class DownloadPagePart extends AbstractPagePart
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
20
    /**
21
     * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
22
     * @ORM\JoinColumn(name="media_id", referencedColumnName="id")
23
     */
24
    protected $media;
25
26
    /**
27
     * Get media
28
     *
29
     * @return Media
30
     */
31
    public function getMedia()
32
    {
33
        return $this->media;
34
    }
35
36
    /**
37
     * Set media
38
     *
39
     * @param Media $media
40
     *
41
     * @return DownloadPagePart
42
     */
43
    public function setMedia($media)
44
    {
45
        $this->media = $media;
46
47
        return $this;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function __toString()
54
    {
55
        if ($this->getMedia()) {
56
            return $this->getMedia()->getUrl();
57
        }
58
59
        return "";
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getDefaultView()
66
    {
67
        return "KunstmaanMediaPagePartBundle:DownloadPagePart:view.html.twig";
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getDefaultAdminType()
74
    {
75
        return DownloadPagePartAdminType::class;
76
    }
77
}
78