<?php

namespace app\models;
use \lithium\util\Validator;

class Profile extends \lithium\data\Model {
	public static function __init() 
	{
		Validator::add('ageism', function($birthday) {
			return true;
		} );
	}
	public $validates = array(
		'birthday' => array(array('date'))
		);

	public static function history($animelist)
	{
		
		$al = $animelist->data();
		return profile::historySort($al, 'my_finish_date');
	}


	public static function historySort($a,$subkey) {
		foreach($a as $k=>$v) {
			$b[$k] = strtolower($v[$subkey]);
		}
		arsort($b);
		foreach($b as $key=>$val) {
			$c[] = $a[$key];
		}
		return $c;
	}
}

?>