class Model_Condition extends Orm\Model
{
protected static $_properties = array('id', 'type', 'operator', 'value');
}
class Model_Condition_Category extends Model_Category
{
public function set_form_fields() {}
public function __toString() {}
public function execute() {}
}
class Model_Condition extends Orm\Model
{
public function as_class($type)
{
$class = 'Model_Condition_'.ucfirst($type);
if ( ! class_exists($class))
{
throw new \FuelException("Class {$class} not found!");
}
return $class::forge( $this->to_array() );
}
}
$condition = $project->conditions[0];
$condition = $condition->as_class( $condition->type );
It looks like you're new here. If you want to get involved, click one of these buttons!