Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
1d0891f0
Commit
1d0891f0
authored
Oct 29, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'yii\mail\MessageInterface' methods 'addText()' and 'addHtml()' removed.
parent
774c4db8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
31 deletions
+44
-31
Message.php
extensions/swiftmailer/yii/swiftmailer/Message.php
+41
-13
MessageInterface.php
framework/yii/mail/MessageInterface.php
+0
-12
MessageTest.php
tests/unit/extensions/swiftmailer/MessageTest.php
+3
-2
BaseMailerTest.php
tests/unit/framework/mail/BaseMailerTest.php
+0
-4
No files found.
extensions/swiftmailer/yii/swiftmailer/Message.php
View file @
1d0891f0
...
@@ -125,7 +125,7 @@ class Message extends BaseMessage
...
@@ -125,7 +125,7 @@ class Message extends BaseMessage
*/
*/
public
function
setText
(
$text
)
public
function
setText
(
$text
)
{
{
$this
->
getSwiftMessage
()
->
setBody
(
$text
,
'text/plain'
);
$this
->
setBody
(
$text
,
'text/plain'
);
}
}
/**
/**
...
@@ -133,23 +133,51 @@ class Message extends BaseMessage
...
@@ -133,23 +133,51 @@ class Message extends BaseMessage
*/
*/
public
function
setHtml
(
$html
)
public
function
setHtml
(
$html
)
{
{
$this
->
getSwiftMessage
()
->
setBody
(
$html
,
'text/html'
);
$this
->
setBody
(
$html
,
'text/html'
);
}
}
/**
/**
* @inheritdoc
* Sets the message body.
* If body is already set and its content type matches given one, it will
* be overridden, if content type miss match the multipart message will be composed.
* @param string $body body content.
* @param string $contentType body content type.
*/
*/
p
ublic
function
addText
(
$text
)
p
rotected
function
setBody
(
$body
,
$contentType
)
{
{
$this
->
getSwiftMessage
()
->
addPart
(
$text
,
'text/plain'
);
$message
=
$this
->
getSwiftMessage
();
}
$oldBody
=
$message
->
getBody
();
if
(
empty
(
$oldBody
))
{
/**
$parts
=
$message
->
getChildren
();
* @inheritdoc
$partFound
=
false
;
*/
foreach
(
$parts
as
$key
=>
$part
)
{
public
function
addHtml
(
$html
)
if
(
!
(
$part
instanceof
\Swift_Mime_Attachment
))
{
{
/* @var $part \Swift_Mime_MimePart */
$this
->
getSwiftMessage
()
->
addPart
(
$html
,
'text/html'
);
if
(
$part
->
getContentType
()
==
$contentType
)
{
unset
(
$parts
[
$key
]);
$partFound
=
true
;
break
;
}
}
}
if
(
$partFound
)
{
reset
(
$parts
);
$message
->
setChildren
(
$parts
);
$message
->
addPart
(
$body
,
$contentType
);
}
else
{
$message
->
setBody
(
$body
,
$contentType
);
}
}
else
{
$oldContentType
=
$message
->
getContentType
();
if
(
$oldContentType
==
$contentType
)
{
$message
->
setBody
(
$body
,
$contentType
);
}
else
{
$message
->
setBody
(
null
);
$message
->
setContentType
(
null
);
$message
->
addPart
(
$oldBody
,
$oldContentType
);
$message
->
addPart
(
$body
,
$contentType
);
}
}
}
}
/**
/**
...
...
framework/yii/mail/MessageInterface.php
View file @
1d0891f0
...
@@ -70,18 +70,6 @@ interface MessageInterface
...
@@ -70,18 +70,6 @@ interface MessageInterface
public
function
setHtml
(
$html
);
public
function
setHtml
(
$html
);
/**
/**
* Add message plain text content part.
* @param string $text message plain text content.
*/
public
function
addText
(
$text
);
/**
* Add message HTML content part.
* @param string $html message HTML content.
*/
public
function
addHtml
(
$html
);
/**
* Attach specified content as file for the email message.
* Attach specified content as file for the email message.
* @param string $content attachment file content.
* @param string $content attachment file content.
* @param array $options options for embed file. Valid options are:
* @param array $options options for embed file. Valid options are:
...
...
tests/unit/extensions/swiftmailer/MessageTest.php
View file @
1d0891f0
...
@@ -182,8 +182,8 @@ class MessageTest extends VendorTestCase
...
@@ -182,8 +182,8 @@ class MessageTest extends VendorTestCase
$message
->
setTo
(
$this
->
testEmailReceiver
);
$message
->
setTo
(
$this
->
testEmailReceiver
);
$message
->
setFrom
(
'someuser@somedomain.com'
);
$message
->
setFrom
(
'someuser@somedomain.com'
);
$message
->
setSubject
(
'Yii Swift Alternative Body Test'
);
$message
->
setSubject
(
'Yii Swift Alternative Body Test'
);
$message
->
add
Html
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
set
Html
(
'<b>Yii Swift</b> test HTML body'
);
$message
->
add
Text
(
'Yii Swift test plain text body'
);
$message
->
set
Text
(
'Yii Swift test plain text body'
);
$this
->
assertTrue
(
$message
->
send
());
$this
->
assertTrue
(
$message
->
send
());
}
}
}
}
\ No newline at end of file
tests/unit/framework/mail/BaseMailerTest.php
View file @
1d0891f0
...
@@ -182,10 +182,6 @@ class Message extends BaseMessage
...
@@ -182,10 +182,6 @@ class Message extends BaseMessage
public
function
setHtml
(
$html
)
{}
public
function
setHtml
(
$html
)
{}
public
function
addText
(
$text
)
{}
public
function
addHtml
(
$html
)
{}
public
function
attachContent
(
$content
,
array
$options
=
[])
{}
public
function
attachContent
(
$content
,
array
$options
=
[])
{}
public
function
attachFile
(
$fileName
,
array
$options
=
[])
{}
public
function
attachFile
(
$fileName
,
array
$options
=
[])
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment