How do query, active record reuse works?

Hello everyone,

I am using a function to loop all records and then display it as a string.




public function formatArraytoStringList($object_rel, $object_rel_join, $attribute)

{

	$out = array();

	if(!empty($object_rel_join))

	{

		foreach($this->$object_rel as $data)

			$out[] = $data->$object_rel_join->$attribute;

	}

				

	return implode($out, ", ");

}


$model->formatArraytoStringList('CuisineStore','Cuisine','name')



My question is if I call the method multiple times, will it do the query again or it is already stored somewhere so that I can call it multiple times and not worry about the resource the query is generating?

Thank you friends,

Jian

looking at the code above, no it would not fire the query again it will pull data from the object in memory

Thank you for confirming this sir. :) I appreciate it.