Skip to content

Commit

Permalink
Programmes 6323 deal with parents in other partner pids (#245)
Browse files Browse the repository at this point in the history
* Add new entity to track changes skipped due to parents in another partner_pid
  • Loading branch information
BjornTwachtmann authored Apr 18, 2018
1 parent 45f66ed commit dbda539
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/Data/ProgrammesDb/Entity/PipsAutoSkippedChange.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace BBC\ProgrammesPagesService\Data\ProgrammesDb\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* This table lists all changes relating to our desired partner_pids that have been skipped due to having a parent in
* another partner_pid we do not ingest.
* It's here so we have a permanent record of when that happens and can re-ingest if necessary.
*
* We do this because there's really no sane way to deal with that case other than "ingest everything in all
* partner_pids", which would require a massive rewrite of our queries and reingest of all data.
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="BBC\ProgrammesPagesService\Data\ProgrammesDb\EntityRepository\PipsAutoSkippedChangeRepository")
*/
class PipsAutoSkippedChange extends PipsChangeBase
{
/**
* The ID of the parent entity that caused this (otherwise valid) change event to be auto-skipped.
* @var string
*
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $triggeringEntityId;

/**
* @return string
*/
public function getTriggeringEntityId(): string
{
return $this->triggeringEntityId;
}

/**
* @param string $triggeringEntityId
*/
public function setTriggeringEntityId(string $triggeringEntityId)
{
$this->triggeringEntityId = $triggeringEntityId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace BBC\ProgrammesPagesService\Data\ProgrammesDb\EntityRepository;

use BBC\ProgrammesPagesService\Data\ProgrammesDb\Entity\PipsAutoSkippedChange;
use Doctrine\ORM\EntityRepository;

class PipsAutoSkippedChangeRepository extends EntityRepository
{
public function addSkippedEntity(PipsAutoSkippedChange $pipsSkippedEntity)
{
$em = $this->getEntityManager();
$em->persist($pipsSkippedEntity);
$em->flush();
}

/**
* @param mixed $cid
* @return null|PipsAutoSkippedChange
*/
public function findById($cid)
{
return $this->find($cid);
}
}

0 comments on commit dbda539

Please sign in to comment.