?
avatar michelollivier
michelollivier
20 Dec 2016

Hello,

In j3.6 + php7 following return a list of strings. Columns data types are not rendered.

<?php 
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->qn('#__users'));
$db->setQuery($query);
?>
<pre><?php echo var_dump( $db->loadObjectList()); ?></pre>

More problematic is

<?php 
$user = JFactory::getUser();
$user_id = $user->id;
?>

$user_id is not recognized as an integer.

Do you know how to return data with their native type?

Regards
Michel

avatar michelollivier michelollivier - open - 20 Dec 2016
avatar joomla-cms-bot joomla-cms-bot - change - 20 Dec 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Dec 2016
avatar michelollivier michelollivier - change - 20 Dec 2016
The description was changed
avatar michelollivier michelollivier - edited - 20 Dec 2016
avatar michelollivier michelollivier - change - 20 Dec 2016
The description was changed
avatar michelollivier michelollivier - edited - 20 Dec 2016
avatar michelollivier michelollivier - change - 20 Dec 2016
The description was changed
avatar michelollivier michelollivier - edited - 20 Dec 2016
avatar michelollivier michelollivier - edited - 20 Dec 2016
avatar Bakual Bakual - change - 22 Dec 2016
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-12-22 12:59:21
Closed_By Bakual
avatar Bakual Bakual - close - 22 Dec 2016
avatar Bakual
Bakual - comment - 22 Dec 2016

I don't think you can return them in the native type. They always come back as strings.
Just use this:

$user = JFactory::getUser();
$user_id = (int) $user->id;

Add a Comment

Login with GitHub to post a comment