Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/model/setting/repository.php
<?php


class AnModelSettingRepository extends AnDomainRepositoryDefault
{
	/**
	 * Return a setting object for an application and actor, if not exists it creates a new one
	 * @return 
	 * @param $application AnModelApplication Object
	 * @param $actor AnModelActor Object
	 */
	public function getSetting($application, $actor)
	{
		$setting = KFactory::get('lib.anahita.domain.factory.query')->get('lib.anahita.model.setting')
				->where('application','=',  $application)
				->where('actor',	  '=',  $actor)
				->fetch();
		;
		
		if ( !$setting )  {
			
			$setting = KFactory::get('lib.anahita.domain.factory.model')->get('lib.anahita.model.setting', array(
				'application' => $application ,
				'actor'		  => $actor
			));
			
			if ( !$setting->validateForInsert() ) {
				$setting->markClean();
			}
			
		}
				
		return $setting;
	}
}
Return current item: Anahita Social Engine