<commit_before><?php
/**
 * Applicative event that raised implicitly by the developer
 * @package Core
 * @subpackage events
 */
abstract class kApplicativeEvent extends KalturaEvent implements IKalturaContinualEvent
{
	/**
	 * @var BaseObject
	 */
	protected $object;
	
	/**
	 * @var BatchJob
	 */
	protected $raisedJob;
	
	/**
	 * @param BaseObject $object
	 * @param BatchJob $raisedJob
	 */
	public function __construct(BaseObject $object, BatchJob $raisedJob = null)
	{
		$this->object = $object;
		$this->raisedJob = $raisedJob;
		
		$additionalLog = '';
		if(method_exists($object, 'getId'))
			$additionalLog .= ' id [' . $object->getId() . ']';
		if($raisedJob)
			$additionalLog .= ' raised job id [' . $raisedJob->getId() . '] of type [' . $raisedJob->getJobType() . ']';
			
		KalturaLog::debug("Event [" . get_class($this) . "] object type [" . get_class($object) . "]" . $additionalLog);
	}
	
	public function getKey()
	{
		if(method_exists($this->object, 'getId'))
			return get_class($this)."_".get_class($this->object)."_".$this->object->getId();
		
		return null;
	}
	
	/**
	 * @return BaseObject $object
	 */
	public function getObject() 
	{
		return $this->object;
	}

	/**
	 * @return BatchJob $raisedJob
	 */
	public function getRaisedJob() 
	{
		return $this->raisedJob;
	}
	
	/* (non-PHPdoc)
	 * @see KalturaEvent::getScope()
	 */
	public function getScope()
	{
		$scope = parent::getScope();
		$scope->setPartnerId($this->raisedJob->getPartnerId());
		$scope->setParentRaisedJob($this->raisedJob);
		return $scope;
	}
}<commit_msg>qnd: try to get the partner id from the object first<commit_after><?php
/**
 * Applicative event that raised implicitly by the developer
 * @package Core
 * @subpackage events
 */
abstract class kApplicativeEvent extends KalturaEvent implements IKalturaContinualEvent
{
	/**
	 * @var BaseObject
	 */
	protected $object;
	
	/**
	 * @var BatchJob
	 */
	protected $raisedJob;
	
	/**
	 * @param BaseObject $object
	 * @param BatchJob $raisedJob
	 */
	public function __construct(BaseObject $object, BatchJob $raisedJob = null)
	{
		$this->object = $object;
		$this->raisedJob = $raisedJob;
		
		$additionalLog = '';
		if(method_exists($object, 'getId'))
			$additionalLog .= ' id [' . $object->getId() . ']';
		if($raisedJob)
			$additionalLog .= ' raised job id [' . $raisedJob->getId() . '] of type [' . $raisedJob->getJobType() . ']';
			
		KalturaLog::debug("Event [" . get_class($this) . "] object type [" . get_class($object) . "]" . $additionalLog);
	}
	
	public function getKey()
	{
		if(method_exists($this->object, 'getId'))
			return get_class($this)."_".get_class($this->object)."_".$this->object->getId();
		
		return null;
	}
	
	/**
	 * @return BaseObject $object
	 */
	public function getObject() 
	{
		return $this->object;
	}

	/**
	 * @return BatchJob $raisedJob
	 */
	public function getRaisedJob() 
	{
		return $this->raisedJob;
	}
	
	/* (non-PHPdoc)
	 * @see KalturaEvent::getScope()
	 */
	public function getScope()
	{
		$scope = parent::getScope();
		
		if(method_exists($this->object, 'getPartnerId'))
			$scope->setPartnerId($this->object->getPartnerId());
		elseif($this->raisedJob)
			$scope->setPartnerId($this->raisedJob->getPartnerId());
			
		$scope->setParentRaisedJob($this->raisedJob);
		return $scope;
	}
}
{'fraction_non_alphanumeric': 0.17461281506225326, 'fraction_numerical': 0.0, 'mean_word_length': 3.739568345323741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493573', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1097, 'n_words': 220}