Skip to content

Commit 5a1f567

Browse files
committed
Merge pull request #400 from cakephp/issue-392
Make panel data binary values.
2 parents 816d40d + e19f55c commit 5a1f567

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Diff for: src/Model/Entity/Panel.php

+16
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,20 @@ class Panel extends Entity
2525
* @var array
2626
*/
2727
protected $_hidden = ['content'];
28+
29+
/**
30+
* Read the stream contents.
31+
*
32+
* Over certain sizes PDO will return file handles.
33+
* For backwards compatibility and consistency we smooth over that difference here.
34+
*
35+
* @return string
36+
*/
37+
protected function _getContent($content)
38+
{
39+
if (is_resource($content)) {
40+
return stream_get_contents($content);
41+
}
42+
return $content;
43+
}
2844
}

Diff for: tests/Fixture/PanelsFixture.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PanelsFixture extends TestFixture
3333
'title' => ['type' => 'string'],
3434
'element' => ['type' => 'string'],
3535
'summary' => ['type' => 'string'],
36-
'content' => ['type' => 'text'],
36+
'content' => ['type' => 'binary'],
3737
'_constraints' => [
3838
'primary' => ['type' => 'primary', 'columns' => ['id']],
3939
'unique_panel' => ['type' => 'unique', 'columns' => ['request_id', 'panel']],

0 commit comments

Comments
 (0)