/** * This constructor initializes the class. * * @access public * @param DB_ORM_Model $model a reference to the implementing model * @param string $field the name of field in the database table * @throws Throwable_InvalidArgument_Exception indicates that an invalid field name * was specified */ public function __construct(DB_ORM_Model $model, $field) { if (!is_string($field) or $model->is_adaptor($field) or $model->is_alias($field) or !$model->is_field($field) or $model->is_relation($field)) { throw new Throwable_InvalidArgument_Exception('Message: Invalid field name defined. Reason: Field name either is not a field or is already defined.', array(':field' => $field)); } $this->model = $model; $this->metadata['field'] = $field; }