0

I am using the JTable class, but I have an issue, at the moment I export the data I get from the table via this way:

$table = $this->getTable('Articles');
$table->load($id);

$properties  = $table->getProperties(1);
return ArrayHelper::toObject($properties, 'JObject');

But this spits out a Object. Now I want to spit out an array, so I can access the data via the $array['keyname'] way. (Instead of $array->keyname right now)

But how do I do that?

return ArrayHelper::toObject($properties, 'Array');

I tried the above but obviously that is not working.

4

$table->getProperties() already returns an array. You need to remove ArrayHelper::toObject() call which converts the array to an object.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.