Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
Problem with output_filter
itcan
November 2014
Hi,
I have this problem. I enabled output_filtering, like this:
config.php
[code]
'output_filter' => array('Security::htmlentities'),
'whitelisted_classes' => array(
'stdClass',
'Fuel\\Core\\Response',
'Fuel\\Core\\View',
'Fuel\\Core\\Presenter',
'Fuel\\Core\\Validation',
'Closure',
),
[/code]
But now I get errors when loading query data...
[code]
$query = \DB::select()
->from('test')
->where('user_id', '=', $user_id)
->order_by('date', 'DESC')
->as_object()
->execute();
return $query;
[/code]
I get this error:
Database results are read-only
itcan
November 2014
When I do this:
$query = \DB::select()
->from('test')
->where('user_id', '=', $user_id)
->order_by('date', 'DESC')
->execute()
->as_array();
it seems to work... But I want to use objects...
Harro
November 2014
The DB driver does:
if ($as_object === false)
{
$result = $result->fetchAll(\PDO::FETCH_ASSOC);
}
elseif (is_string($as_object))
{
$result = $result->fetchAll(\PDO::FETCH_CLASS, $as_object);
}
else
{
$result = $result->fetchAll(\PDO::FETCH_CLASS, 'stdClass');
}
// Return an iterator of results
return new \Database_Result_Cached($result, $sql, $as_object);
so ->as_object() should return a collection of stdClass objects.
It is Database_Result_Cached which is read-only, and should be excluded in the whitelist, not stdClass.
itcan
November 2014
Ok... I will try. I use mysqli btw
itcan
November 2014
mmm doesn't seem to work... if I whitelist
Database_Result_Cached...
What I noticed is when I select the current() record, it works...
itcan
November 2014
Or is it only possible to pass arrays to my view?
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
November 2014
itcan
November 2014