/** * Constructs a new Jam_Builder instance. * * $model is not actually allowed to be NULL. It has * a default because PHP throws strict errors otherwise. * * @throws Kohana_Exception * @param string|null $model * @param mixed|null $key */ public function __construct($model) { parent::__construct(); $this->_meta = Jam::meta($model); if (!$this->_meta) { throw new Kohana_Exception('There is no model :model for select', array(':model' => $model)); } $this->meta()->events()->trigger('builder.after_construct', $this); }
/** * Constructs a new Jelly_Builder instance. * * $model is not actually allowed to be NULL. It has * a default because PHP throws strict errors otherwise. * * @throws Kohana_Exception * @param string|null $model * @param mixed|null $key */ public function __construct($model = NULL, $key = NULL) { parent::__construct(); if (!$model) { throw new Kohana_Exception(get_class($this) . ' requires $model to be set in the constructor'); } // Set the model and the initial from() $this->_model = Jelly::model_name($model); $this->_meta = Jelly::meta($this->_model); $this->_initialize(); // Default to using our key if ($key !== NULL) { $this->key($key); } }