Completed
Push — develop ( 71c4a2...916121 )
by
unknown
06:35
created

OrganizationImage::preRemove()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/** UserImage.php */
11
namespace Organizations\Entity;
12
13
use Core\Entity\ImageInterface;
14
use Core\Entity\ImageTrait;
15
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
16
use Zend\Permissions\Acl\Resource\ResourceInterface;
17
use Core\Entity\FileEntity;
18
19
/**
20
 * Defines the logo of an organization.
21
 *
22
 * @ODM\Document(collection="organizations.images", repositoryClass="Organizations\Repository\OrganizationImage")
23
 */
24
class OrganizationImage extends FileEntity implements ImageInterface
25
{
26
    use ImageTrait;
27
28
    /**
29
     * Organization which belongs to the company logo
30
     *
31
     * @var Organization
32
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\Organization", mappedBy="image")
33
     */
34
    protected $organization;
35
36
    /**
37
     * {@inheritDoc}
38
     * @see \Zend\Permissions\Acl\Resource\ResourceInterface::getResourceId()
39
     */
40
    public function getResourceId()
41
    {
42
        return 'Entity/OrganizationImage';
43
    }
44
45
    /**
46
     * Gets the URI of an attachment
47
     *
48
     * @return string
49
     */
50
    function getUri()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
51
    {
52
        return '/' . trim('file/Organizations.OrganizationImage/' . $this->id . "/" . urlencode($this->name),'/');
53
    }
54
55
    /**
56
     * Gets the organization of an company logo
57
     *
58
     * @return Organization
59
     */
60
    public function getOrganization()
61
    {
62
        return $this->organization;
63
    }
64
65
    /**
66
     * @param Organization $organization
67
     */
68
    public function setOrganization(Organization $organization)
69
    {
70
        $this->organization = $organization;
71
    }
72
}
73