7
7
use eZ \Publish \Core \Helper \TranslationHelper ;
8
8
use eZ \Publish \API \Repository \Values \Content \Content ;
9
9
use Netgen \Bundle \InformationCollectionBundle \Value \EmailData ;
10
+ use Netgen \Bundle \InformationCollectionBundle \Constants ;
10
11
11
12
class EmailDataFactory
12
13
{
@@ -61,9 +62,9 @@ public function __construct(
61
62
public function build (Content $ content )
62
63
{
63
64
return new EmailData (
64
- $ this ->resolve ($ content , ' recipient ' , ' email ' ),
65
- $ this ->resolve ($ content , ' sender ' , ' email ' ),
66
- $ this ->resolve ($ content , ' subject ' ),
65
+ $ this ->resolve ($ content , Constants:: FIELD_RECIPIENT , Constants:: FIELD_TYPE_EMAIL ),
66
+ $ this ->resolve ($ content , Constants:: FIELD_SENDER , Constants:: FIELD_TYPE_EMAIL ),
67
+ $ this ->resolve ($ content , Constants:: FIELD_SUBJECT ),
67
68
$ this ->resolveTemplate ($ content )
68
69
);
69
70
}
@@ -75,9 +76,9 @@ public function build(Content $content)
75
76
* @param string $field
76
77
* @param string $property
77
78
*
78
- * @return mixed
79
+ * @return string
79
80
*/
80
- protected function resolve (Content $ content , $ field , $ property = ' text ' )
81
+ protected function resolve (Content $ content , $ field , $ property = Constants:: FIELD_TYPE_TEXT )
81
82
{
82
83
if (array_key_exists ($ field , $ content ->fields ) &&
83
84
!$ this ->fieldHelper ->isFieldEmpty ($ content , $ field )
0 commit comments