mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
Add token entities and repositories
This commit is contained in:
83
lib/Doctrine/Entities/AggregateToken.php
Normal file
83
lib/Doctrine/Entities/AggregateToken.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AggregateToken
|
||||||
|
*/
|
||||||
|
class AggregateToken
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $usr_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set usr_id
|
||||||
|
*
|
||||||
|
* @param integer $usrId
|
||||||
|
* @return AggregateToken
|
||||||
|
*/
|
||||||
|
public function setUsrId($usrId)
|
||||||
|
{
|
||||||
|
$this->usr_id = $usrId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get usr_id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getUsrId()
|
||||||
|
{
|
||||||
|
return $this->usr_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return AggregateToken
|
||||||
|
*/
|
||||||
|
public function setValue($value)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
}
|
108
lib/Doctrine/Entities/FeedToken.php
Normal file
108
lib/Doctrine/Entities/FeedToken.php
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
class FeedToken
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $usr_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Entities\Feed
|
||||||
|
*/
|
||||||
|
private $feed;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set usr_id
|
||||||
|
*
|
||||||
|
* @param integer $usrId
|
||||||
|
* @return FeedToken
|
||||||
|
*/
|
||||||
|
public function setUsrId($usrId)
|
||||||
|
{
|
||||||
|
$this->usr_id = $usrId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get usr_id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getUsrId()
|
||||||
|
{
|
||||||
|
return $this->usr_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feed
|
||||||
|
*
|
||||||
|
* @param \Entities\Feed $feed
|
||||||
|
* @return FeedToken
|
||||||
|
*/
|
||||||
|
public function setFeed(\Entities\Feed $feed = null)
|
||||||
|
{
|
||||||
|
$this->feed = $feed;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get feed
|
||||||
|
*
|
||||||
|
* @return \Entities\Feed
|
||||||
|
*/
|
||||||
|
public function getFeed()
|
||||||
|
{
|
||||||
|
return $this->feed;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return FeedToken
|
||||||
|
*/
|
||||||
|
public function setValue($value)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
}
|
29
lib/Doctrine/Repositories/AggregateTokenRepository.php
Normal file
29
lib/Doctrine/Repositories/AggregateTokenRepository.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Repositories;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Entities\Feed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AggregateTokenRepository
|
||||||
|
*
|
||||||
|
* This class was generated by the Doctrine ORM. Add your own custom
|
||||||
|
* repository methods below.
|
||||||
|
*/
|
||||||
|
class AggregateTokenRepository extends EntityRepository
|
||||||
|
{
|
||||||
|
public function findByUser(\User_Adapter $user)
|
||||||
|
{
|
||||||
|
$dql = 'SELECT t
|
||||||
|
FROM Entities\AggregateToken t
|
||||||
|
WHERE t.usr_id = :usr_id';
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$query->setParameters(array(
|
||||||
|
':usr_id' => $user->get_id())
|
||||||
|
);
|
||||||
|
|
||||||
|
return $query->getOneOrNullResult();
|
||||||
|
}
|
||||||
|
}
|
31
lib/Doctrine/Repositories/FeedTokenRepository.php
Normal file
31
lib/Doctrine/Repositories/FeedTokenRepository.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Repositories;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Entities\Feed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FeedTokenRepository
|
||||||
|
*
|
||||||
|
* This class was generated by the Doctrine ORM. Add your own custom
|
||||||
|
* repository methods below.
|
||||||
|
*/
|
||||||
|
class FeedTokenRepository extends EntityRepository
|
||||||
|
{
|
||||||
|
public function findByFeedAndUser(Feed $feed, \User_Adapter $user)
|
||||||
|
{
|
||||||
|
$dql = 'SELECT t
|
||||||
|
FROM Entities\FeedToken t
|
||||||
|
WHERE t.feed = :feed
|
||||||
|
AND t.usr_id = :usr_id';
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$query->setParameters(array(
|
||||||
|
':feed' => $feed,
|
||||||
|
':usr_id' => $user->get_id())
|
||||||
|
);
|
||||||
|
|
||||||
|
return $query->getOneOrNullResult();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user