I came across this piece of code written by previous developers and I am confused by result of this find() method. It is all gibberish. What does it actually return when no arguments are passed to it?
$designation = new DesignationsModel();
$designations = $designation->find();
DesignationModel Class is as follows:
class DesignationsModel extends \DB\SQL\Mapper {
private $f3;
private static $instance;
protected $_name = 'designations';
// Instantiate mapper
function __construct() {
$db = \Base::instance()->get('DB');
$this->f3 = \Base::instance();
// This is where the mapper and DB structure synchronization occurs
parent::__construct($db, $this->_name);
}
The result of $designations is used in View as:
<select name="designation_id" class="form-control" id="designations">
<option></option>
<?php
foreach ($designations as $designation):
if (isset($edit)):
if ($designation->id === $users->designation_id) :
?>
<option value="<?php echo $designation->id; ?>" selected><?php echo $designation->title; ?></option>
<?php
endif;
endif;
?>
<option value="<?php echo $designation->id; ?>"><?php echo $designation->title; ?></option>
<?php endforeach; ?>
</select>