View difference between Paste ID: YihvHj4m and AjaQB963
SHOW: | | - or go back to the newest paste.
1
<?php
2
namespace WL\Test\Domain\Model;
3
4
use TYPO3\Flow\Annotations as Flow;
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * A Master
9
 *
10
 * @Flow\Entity
11
 */
12
class Master {
13
14
	/**
15
	 * The name
16
	 * @var string
17
	 */
18
	protected $name;
19
20
21
	/**
22
	 * @var \WL\Test\Domain\Model\Image
23
	 * @ORM\ManyToMany
24
	 */
25
	protected $image;
26
	/**
27
	 * Get the Master's name
28
	 *
29
	 * @return string The Master's name
30
	 */
31
	public function getName() {
32
		return $this->name;
33
	}
34
35
	/**
36
	 * Sets this Master's name
37
	 *
38
	 * @param string $name The Master's name
39
	 * @return void
40
	 */
41
	public function setName($name) {
42
		$this->name = $name;
43
	}
44
45
46
	/**
47
	 * @param return \WL\Test\Domain\Model\Image $image
48
	 * @return void
49
	 */
50
	public function setImage(\WL\Test\Domain\Model\Image $image) {
51
		$this->picture = $image;
52
	}
53
54
	/**
55
	 * @return \WL\Test\Domain\Model\Image
56
	 */
57
	public function getImage() {
58
		return $this->image;
59
	}
60
}
61
?>
62
###########################################################################################
63
<?php
64
namespace WL\Test\Domain\Model;
65
66
use Doctrine\ORM\Mapping as ORM;
67
use TYPO3\Flow\Annotations as Flow;
68
69
/**
70
 * An image
71
 *
72
 * @Flow\Scope("prototype")
73
 * @Flow\Entity
74
 */
75
class Image {
76
77
	/**
78
	 * @var string
79
	 */
80
	protected $title;
81
82
	/**
83
	 * @var \TYPO3\Flow\Resource\Resource
84
	 * @ORM\ManyToOne
85
	 * @Flow\Validate(type="NotEmpty")
86
	 */
87
	protected $originalResource;
88
89
	/**
90
	 * @param string $title
91
	 * @return void
92
	 */
93
	public function setTitle($title) {
94
		$this->title = $title;
95
	}
96
97
	/**
98
	 * @return string The title
99
	 */
100
	public function getTitle() {
101
		return $this->title;
102
	}
103
104
	/**
105
	 * @param \TYPO3\Flow\Resource\Resource $originalResource
106
	 * @return void
107
	 */
108
	public function setOriginalResource(\TYPO3\Flow\Resource\Resource $originalResource) {
109
		$this->originalResource = $originalResource;
110
	}
111
112
	/**
113
	 * @return \TYPO3\Flow\Resource\Resource $originalResource
114
	 */
115
	public function getOriginalResource() {
116
		return $this->originalResource;
117
	}
118
}
119
120
#####################################FORM########################################
121
	<f:form action="create"  name="newMaster" object="newMaster" enctype="multipart/form-data">
122
		<label for="name">Name</label>
123
		<f:form.textfield property="name" id="name" />
124
		<f:form.hidden property="image.title" value="newpic"/>
125
		<f:form.upload property="image.originalResource" />
126
		<f:form.submit value="Create" />
127
	</f:form>