Skip to content

Commit

Permalink
Merge pull request #400 from cakephp/issue-392
Browse files Browse the repository at this point in the history
Make panel data binary values.
  • Loading branch information
lorenzo committed Jan 5, 2016
2 parents 816d40d + e19f55c commit 5a1f567
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Model/Entity/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,20 @@ class Panel extends Entity
* @var array
*/
protected $_hidden = ['content'];

/**
* Read the stream contents.
*
* Over certain sizes PDO will return file handles.
* For backwards compatibility and consistency we smooth over that difference here.
*
* @return string
*/
protected function _getContent($content)
{
if (is_resource($content)) {
return stream_get_contents($content);
}
return $content;
}
}
2 changes: 1 addition & 1 deletion tests/Fixture/PanelsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PanelsFixture extends TestFixture
'title' => ['type' => 'string'],
'element' => ['type' => 'string'],
'summary' => ['type' => 'string'],
'content' => ['type' => 'text'],
'content' => ['type' => 'binary'],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id']],
'unique_panel' => ['type' => 'unique', 'columns' => ['request_id', 'panel']],
Expand Down

0 comments on commit 5a1f567

Please sign in to comment.