Completed
Pull Request — develop (#236)
by ANTHONIUS
07:34
created

ContactImage::getContact()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
10
namespace Cv\Entity;
11
12
use Core\Entity\FileEntity;
13
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
14
15
/**
16
 * @ODM\Document(collection="cvs.contact.images")
17
 * @ODM\HasLifecycleCallbacks()
18
 */
19
class ContactImage extends FileEntity
20
{
21
    /**
22
     * @var Contact
23
     */
24
    protected $contact;
25
    
26
27
    /**
28
     * Gets the URI of an image
29
     *
30
     * The returned URI is NOT prepended with the base path!
31
     *
32
     * @return string
33
     */
34
    public function getUri()
35
    {
36
        return "/file/Cv.ContactImage/" . $this->id . "/" .urlencode($this->name);
37
    }
38
    
39
    /**
40
     * @ODM\PreRemove
41
     */
42
    public function preRemove()
43
    {
44
        $this->contact->setImage(null);
45
    }
46
    
47
	/**
48
	 * @param Contact $contact
49
	 * @return ContactImage
50
	 */
51
	public function setContact(Contact $contact)
52
	{
53
		$this->contact = $contact;
54
		
55
		return $this;
56
	}
57
58
    /**
59
     * @return Contact
60
     */
61
    public function getContact()
62
    {
63
        return $this->contact;
64
    }
65
}
66