<commit_before><?php

/**
 * Subclass for representing a row from the 'syndication_feed' table.
 *
 * 
 *
 * @package Core
 * @subpackage model
 */ 
class syndicationFeed extends BasesyndicationFeed implements IBaseObject
{
	const CUSTOM_DATA_MRSS_PARAMETERS = 'mrss_parameters';
	const CUSTOM_DATA_STORAGE_ID = 'storage_id';
	const CUSTOM_DATA_ENTRIES_ORDER_BY = 'entries_order_by';
	const CUSTOM_DATA_ENFORCE_ORDER = 'enforce_order';
	const CUSTOM_DATA_SERVE_PLAY_MANIFEST = 'serve_play_manifest';
	const CUSTOM_DATA_USE_CATEGORY_ENTRIES = 'use_category_entries';
	const CUSTOM_DATA_PLAYER_TYPE = 'player_type';
	const CUSTOM_DATA_FEED_CONTENT_TYPE_HEADER = 'feed_content_type_header';
	const CUSTOM_DATA_ENFORCE_AUTHOR = 'enforce_feed_author';

	// copied from KalturaSyndicationFeedStatus
	const SYNDICATION_DELETED = -1;
	const SYNDICATION_ACTIVE = 1;
	
	// don't stop until a unique hash is created for this object
	private static function calculateId ( )
	{
		$dc = kDataCenterMgr::getCurrentDc();
		for ( $i = 0 ; $i < 10 ; ++$i)
		{
			$id = $dc["id"].'_'.kString::generateStringId();
			$existing_object = syndicationFeedPeer::retrieveByPKNoFilter( $id );
			
			if ( ! $existing_object ) return $id;
		}
		
		die();
	}
        
	public function save(PropelPDO $con = null)
	{
		$is_new = false;
		if ( $this->isNew() )
		{
			$this->setId(self::calculateId());
		}
		
		$is_new = true;
		$res = parent::save( $con );
		if ($is_new)
		{
			// when retrieving the entry - ignore thr filter - when in partner has moderate_content =1 - the entry will have status=3 and will fail the retrieveByPk 
			syndicationFeedPeer::setUseCriteriaFilter(false);
			$obj = syndicationFeedPeer::retrieveByPk($this->getId());
			$this->setIntId($obj->getIntId());
			syndicationFeedPeer::setUseCriteriaFilter(true);
		}                
	}

	/* (non-PHPdoc)
	 * @see BasesyndicationFeed::preSave()
	 */
	public function preSave(PropelPDO $con = null)
	{
		if($this->isNew())
		{
			$this->setServePlayManifest(true);
			$this->setPlayerType(PlayerType::HTML5Player);
		}
		
		return parent::preSave($con);
	}
	
	/* (non-PHPdoc)
	 * @see lib/model/om/BasesyndicationFeed#postUpdate()
	 */
	public function postUpdate(PropelPDO $con = null)
	{
		if ($this->alreadyInSave)
			return parent::postUpdate($con);<commit_msg>Avoid PHP fatal error by making save compatible with base class Declaration<commit_after><?php

/**
 * Subclass for representing a row from the 'syndication_feed' table.
 *
 * 
 *
 * @package Core
 * @subpackage model
 */ 
class syndicationFeed extends BasesyndicationFeed implements IBaseObject
{
	const CUSTOM_DATA_MRSS_PARAMETERS = 'mrss_parameters';
	const CUSTOM_DATA_STORAGE_ID = 'storage_id';
	const CUSTOM_DATA_ENTRIES_ORDER_BY = 'entries_order_by';
	const CUSTOM_DATA_ENFORCE_ORDER = 'enforce_order';
	const CUSTOM_DATA_SERVE_PLAY_MANIFEST = 'serve_play_manifest';
	const CUSTOM_DATA_USE_CATEGORY_ENTRIES = 'use_category_entries';
	const CUSTOM_DATA_PLAYER_TYPE = 'player_type';
	const CUSTOM_DATA_FEED_CONTENT_TYPE_HEADER = 'feed_content_type_header';
	const CUSTOM_DATA_ENFORCE_AUTHOR = 'enforce_feed_author';

	// copied from KalturaSyndicationFeedStatus
	const SYNDICATION_DELETED = -1;
	const SYNDICATION_ACTIVE = 1;
	
	// don't stop until a unique hash is created for this object
	private static function calculateId ( )
	{
		$dc = kDataCenterMgr::getCurrentDc();
		for ( $i = 0 ; $i < 10 ; ++$i)
		{
			$id = $dc["id"].'_'.kString::generateStringId();
			$existing_object = syndicationFeedPeer::retrieveByPKNoFilter( $id );
			
			if ( ! $existing_object ) return $id;
		}
		
		die();
	}

	public function save(PropelPDO $con = null, $skipReload = false)
	{
		$is_new = false;
		if ( $this->isNew() )
		{
			$this->setId(self::calculateId());
		}
		
		$is_new = true;
		$res = parent::save($con, $skipReload);
		if ($is_new)
		{
			// when retrieving the entry - ignore thr filter - when in partner has moderate_content =1 - the entry will have status=3 and will fail the retrieveByPk 
			syndicationFeedPeer::setUseCriteriaFilter(false);
			$obj = syndicationFeedPeer::retrieveByPk($this->getId());
			$this->setIntId($obj->getIntId());
			syndicationFeedPeer::setUseCriteriaFilter(true);
		}                
	}

	/* (non-PHPdoc)
	 * @see BasesyndicationFeed::preSave()
	 */
	public function preSave(PropelPDO $con = null)
	{
		if($this->isNew())
		{
			$this->setServePlayManifest(true);
			$this->setPlayerType(PlayerType::HTML5Player);
		}
		
		return parent::preSave($con);
	}
	
	/* (non-PHPdoc)
	 * @see lib/model/om/BasesyndicationFeed#postUpdate()
	 */
	public function postUpdate(PropelPDO $con = null)
	{
		if ($this->alreadyInSave)
			return parent::postUpdate($con);
{'fraction_non_alphanumeric': 0.12356444066354742, 'fraction_numerical': 0.0034028073160357296, 'mean_word_length': 4.494158878504673, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '1767352', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1669, 'n_words': 330}