All pastes #2125331 Raw Edit

Stuff

public php v1 · immutable
#2125331 ·published 2012-03-07 09:52 UTC
rendered paste body
<?phpnamespace Vacancies;class Model_Vacancy extends \Orm\Model implements \YoungsAdmin\Event_Loggable {	protected static $_table_name = 'vacancies';	protected static $_properties = array(		'id' => array(			'data_type' => 'int',		),		'venue_id' => array(			'data_type' => 'int',			'label' => 'Location',			'validation' => array(				'required',			),		),		'vacancy_type_id' => array(			'data_type' => 'int',			'label' => 'Type of Vacancy',			'validation' => array(				'required',			),		),		'quantity' => array(			'data_type' => 'tinyint',			'label' => 'Number of Vacancies',			'default' => 1,			'validation' => array(				'required',				'numeric_min' => array(0),				'numeric_max' => array(255),			),		),		'filled' => array(			'data_type' => 'tinyint',			'label' => 'Number Filled',			'default' => 0,			'validation' => array(				'numeric_min' => array(0),				'numeric_max' => array(255),			),		),		'hours_type' => array(			'data_type' => 'enum',			'label' => 'Hours',			'options' => array(				'Full Time',				'Part Time',			),			'validation' => array(				'required',				'option' => array('hours_type'),			),		),		'salary_range_type' => array(			'data_type' => 'enum',			'label' => 'Salary Range',			'options' => array(				'per annum',				'per hour',				'negotiable',			),			'validation' => array(				'required',				'option' => array('salary_range_type'),			),		),		'salary_range_start' => array(			'data_type' => 'decimal',			'label' => 'Salary Range Start Amount',			'validation' => array(				'numeric_max' => array(999999.99),			),		),		'salary_range_end' => array(			'data_type' => 'decimal',			'label' => 'Salary Range End Amount',			'validation' => array(				'numeric_max' => array(999999.99),			),		),		'about' => array(			'data_type' => 'text',			'label' => 'About The Business',			'validation' => array(				'required',				'max_length' => array(65000),			),		),		'description' => array(			'data_type' => 'text',			'label' => 'About The Role',			'validation' => array(				'required',				'max_length' => array(65000),			),		),		'offer' => array(			'data_type' => 'text',			'label' => 'About The Offer',			'validation' => array(				'required',				'max_length' => array(65000),			),		),		'views' => array(			'data_type' => 'int',			'label' => 'Views',			'default' => 0,		),		'live' => array(			'data_type' => 'bool',			'default' => true,		),		'created_at' => array(			'data_type' => 'int',		),		'updated_at' => array(			'data_type' => 'int',		),	);	protected static $_observers = array(		'Orm\Observer_Validation' => array(			'events' => array('before_save'),		),		'Orm\Observer_Typing' => array(			'events' => array('before_save', 'after_save', 'after_load'),		),		'Jobsite\Observer_PostVacancy' => array(			'events' => array('after_load'),		),		'\Orm\Observer_Self' 	 => array(			'events' => array('before_save','after_insert'),		),		'Orm\Observer_CreatedAt' => array(			'events' => array('before_insert'),		),		'Orm\Observer_UpdatedAt' => array(			'events' => array('before_save'),		),	);	public function _validation_option($val, $field) {		\Validation::active()->set_message('option', ':value is not a valid option for :label');		//return in_array($val, static::$_properties[$this->_current_validation_field->name]['options']);		return in_array($val, static::$_properties[$field]['options']);	}}