forked from ntidev/SyncBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ealcantara22/failed-synchronization-support
Failed synchronization support
- Loading branch information
Showing
10 changed files
with
265 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# composer | ||
/composer.phar | ||
|
||
# Backup entities generated with doctrine:generate:entities command | ||
**/Entity/*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,3 @@ public function setTimestamp($timestamp) | |
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<?php | ||
|
||
namespace NTI\SyncBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
|
||
/** | ||
* Class SyncFailedItemState | ||
* @package NTI\SyncBundle\Entity | ||
* @ORM\Table(name="nti_sync_failed_item_state") | ||
* @ORM\Entity(repositoryClass="NTI\SyncBundle\Repository\SyncFailedItemStateRepository") | ||
* | ||
*/ | ||
class SyncFailedItemState { | ||
|
||
/** | ||
* @var int | ||
* | ||
* @ORM\Column(name="id", type="integer") | ||
* @ORM\Id | ||
* @ORM\GeneratedValue(strategy="AUTO") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var string | ||
* | ||
* @ORM\Column(name="uuid", type="string", length=255, nullable=false, unique=true) | ||
*/ | ||
private $uuid; | ||
|
||
/** | ||
* @var SyncMapping | ||
* | ||
* @ORM\ManyToOne(targetEntity="NTI\SyncBundle\Entity\SyncMapping") | ||
*/ | ||
private $mapping; | ||
|
||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="class_id", type="integer", nullable=true) | ||
*/ | ||
private $classId; | ||
|
||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="timestamp", type="integer", nullable=false) | ||
*/ | ||
private $timestamp; | ||
|
||
/** | ||
* @var string | ||
* | ||
* @ORM\Column(name="errors", columnDefinition="TEXT", length=65535, nullable=true) | ||
*/ | ||
private $errors; | ||
|
||
|
||
/** | ||
* Get id | ||
* | ||
* @return integer | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* Set uuid | ||
* | ||
* @param string $uuid | ||
* | ||
* @return SyncFailedItemState | ||
*/ | ||
public function setUuid($uuid) | ||
{ | ||
$this->uuid = $uuid; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get uuid | ||
* | ||
* @return string | ||
*/ | ||
public function getUuid() | ||
{ | ||
return $this->uuid; | ||
} | ||
|
||
/** | ||
* Set classId | ||
* | ||
* @param integer $classId | ||
* | ||
* @return SyncFailedItemState | ||
*/ | ||
public function setClassId($classId) | ||
{ | ||
$this->classId = $classId; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get classId | ||
* | ||
* @return integer | ||
*/ | ||
public function getClassId() | ||
{ | ||
return $this->classId; | ||
} | ||
|
||
/** | ||
* Set timestamp | ||
* | ||
* @param integer $timestamp | ||
* | ||
* @return SyncFailedItemState | ||
*/ | ||
public function setTimestamp($timestamp) | ||
{ | ||
$this->timestamp = $timestamp; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get timestamp | ||
* | ||
* @return integer | ||
*/ | ||
public function getTimestamp() | ||
{ | ||
return $this->timestamp; | ||
} | ||
|
||
/** | ||
* Set errors | ||
* | ||
* @param string $errors | ||
* | ||
* @return SyncFailedItemState | ||
*/ | ||
public function setErrors($errors) | ||
{ | ||
$this->errors = $errors; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get errors | ||
* | ||
* @return string | ||
*/ | ||
public function getErrors() | ||
{ | ||
return $this->errors; | ||
} | ||
|
||
/** | ||
* Set mapping | ||
* | ||
* @param \NTI\SyncBundle\Entity\SyncMapping $mapping | ||
* | ||
* @return SyncFailedItemState | ||
*/ | ||
public function setMapping(\NTI\SyncBundle\Entity\SyncMapping $mapping = null) | ||
{ | ||
$this->mapping = $mapping; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get mapping | ||
* | ||
* @return \NTI\SyncBundle\Entity\SyncMapping | ||
*/ | ||
public function getMapping() | ||
{ | ||
return $this->mapping; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,3 @@ public function setSyncService($syncService) | |
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,4 @@ public function setTimestamp($timestamp) | |
return $this; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,3 @@ public function setTimestamp($timestamp) | |
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace NTI\SyncBundle\Repository; | ||
|
||
use Doctrine\ORM\EntityRepository; | ||
use Doctrine\ORM\NonUniqueResultException; | ||
|
||
/** | ||
* SyncFailedItemStateRepository | ||
* | ||
* This class was generated by the Doctrine ORM. Add your own custom | ||
* repository methods below. | ||
*/ | ||
class SyncFailedItemStateRepository extends EntityRepository | ||
{ | ||
public function findFromTimestampAndMapping($mappingName, $timestamp) { | ||
$qb = $this->createQueryBuilder('s'); | ||
$qb ->innerJoin('s.mapping', 'm') | ||
->andWhere('m.name = :mappingName') | ||
->setParameter('mappingName', $mappingName) | ||
->andWhere('s.timestamp >= :timestamp') | ||
->setParameter('timestamp', $timestamp) | ||
->orderBy('s.timestamp', 'asc'); | ||
return $qb->getQuery()->getResult(); | ||
} | ||
|
||
public function findByUuId($id){ | ||
$qb = $this->getEntityManager()->createQueryBuilder(); | ||
$qb->select('item') | ||
->from('NTISyncBundle:SyncFailedItemState', 'item') | ||
->andWhere( | ||
$qb->expr()->eq('item.uuid', $qb->expr()->literal($id)) | ||
); | ||
|
||
try { | ||
return $qb->getQuery()->getOneOrNullResult(); | ||
}catch (NonUniqueResultException $e){ | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters