diff --git a/lib/Alchemy/Phrasea/Feed/Aggregate.php b/lib/Alchemy/Phrasea/Feed/Aggregate.php index ca1a347d7b..ea83dab3c2 100644 --- a/lib/Alchemy/Phrasea/Feed/Aggregate.php +++ b/lib/Alchemy/Phrasea/Feed/Aggregate.php @@ -40,8 +40,8 @@ class Aggregate implements FeedInterface private $em; /** - * @param EntityManager $em - * @param array $feeds + * @param EntityManager $em + * @param array $feeds * @param AggregateToken $token * * @return Aggregate @@ -86,7 +86,7 @@ class Aggregate implements FeedInterface * Creates an aggregate from given Feed id array. * * @param EntityManager $em - * @param array $feed_ids + * @param array $feed_ids * * @return Aggregate */ @@ -214,6 +214,7 @@ class Aggregate implements FeedInterface if (0 > $page && $page <= $count / $pageSize) { return true; } + return false; } diff --git a/lib/Alchemy/Phrasea/Feed/AggregateToken.php b/lib/Alchemy/Phrasea/Feed/AggregateToken.php index 175c793154..96edf496c0 100644 --- a/lib/Alchemy/Phrasea/Feed/AggregateToken.php +++ b/lib/Alchemy/Phrasea/Feed/AggregateToken.php @@ -40,7 +40,7 @@ class AggregateToken /** * Set usr_id * - * @param integer $usrId + * @param integer $usrId * @return AggregateToken */ public function setUsrId($usrId) @@ -63,7 +63,7 @@ class AggregateToken /** * Set feed * - * @param Aggregate $feed + * @param Aggregate $feed * @return AggregateToken */ public function setFeed(\Entities\Feed $feed = null) @@ -90,7 +90,7 @@ class AggregateToken /** * Set value * - * @param string $value + * @param string $value * @return AggregateToken */ public function setValue($value) diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php index 8b6a57acd3..6498cd4beb 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php @@ -156,7 +156,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf if ($entry->getAuthorName()) { $this->addTag($document, $author, 'name', $entry->getAuthorName()); } - + $this->addTag($document, $entry_node, 'content', $entry->getSubtitle()); foreach ($entry->getItems() as $content) { diff --git a/lib/Doctrine/Entities/Feed.php b/lib/Doctrine/Entities/Feed.php index b4d2eea8ad..62b0cc5595 100644 --- a/lib/Doctrine/Entities/Feed.php +++ b/lib/Doctrine/Entities/Feed.php @@ -280,7 +280,7 @@ class Feed implements FeedInterface /** * Returns the collection to which the feed belongs. * - * @param Application $app + * @param Application $app * * @return type */ @@ -524,6 +524,7 @@ class Feed implements FeedInterface if (0 > $page && $page <= $count / $pageSize) { return true; } + return false; } } diff --git a/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php b/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php deleted file mode 100644 index 0f5f7fb556..0000000000 --- a/lib/Doctrine/Proxies/__CG__EntitiesLazaretCheck.php +++ /dev/null @@ -1,106 +0,0 @@ -_entityPersister = $entityPersister; - $this->_identifier = $identifier; - } - /** @private */ - public function __load() - { - if (!$this->__isInitialized__ && $this->_entityPersister) { - $this->__isInitialized__ = true; - - if (method_exists($this, "__wakeup")) { - // call this after __isInitialized__to avoid infinite recursion - // but before loading to emulate what ClassMetadata::newInstance() - // provides. - $this->__wakeup(); - } - - if ($this->_entityPersister->load($this->_identifier, $this) === null) { - throw new \Doctrine\ORM\EntityNotFoundException(); - } - unset($this->_entityPersister, $this->_identifier); - } - } - - /** @private */ - public function __isInitialized() - { - return $this->__isInitialized__; - } - - - public function getId() - { - if ($this->__isInitialized__ === false) { - return (int) $this->_identifier["id"]; - } - $this->__load(); - return parent::getId(); - } - - public function setCheckClassname($checkClassname) - { - $this->__load(); - return parent::setCheckClassname($checkClassname); - } - - public function getCheckClassname() - { - $this->__load(); - return parent::getCheckClassname(); - } - - public function setLazaretFile(\Entities\LazaretFile $lazaretFile = NULL) - { - $this->__load(); - return parent::setLazaretFile($lazaretFile); - } - - public function getLazaretFile() - { - $this->__load(); - return parent::getLazaretFile(); - } - - public function getMessage() - { - $this->__load(); - return parent::getMessage(); - } - - - public function __sleep() - { - return array('__isInitialized__', 'id', 'checkClassname', 'lazaretFile'); - } - - public function __clone() - { - if (!$this->__isInitialized__ && $this->_entityPersister) { - $this->__isInitialized__ = true; - $class = $this->_entityPersister->getClassMetadata(); - $original = $this->_entityPersister->load($this->_identifier); - if ($original === null) { - throw new \Doctrine\ORM\EntityNotFoundException(); - } - foreach ($class->reflFields as $field => $reflProperty) { - $reflProperty->setValue($this, $reflProperty->getValue($original)); - } - unset($this->_entityPersister, $this->_identifier); - } - - } -} \ No newline at end of file diff --git a/lib/Doctrine/Proxies/__CG__EntitiesValidationParticipant.php b/lib/Doctrine/Proxies/__CG__EntitiesValidationParticipant.php deleted file mode 100644 index cef3296458..0000000000 --- a/lib/Doctrine/Proxies/__CG__EntitiesValidationParticipant.php +++ /dev/null @@ -1,196 +0,0 @@ -_entityPersister = $entityPersister; - $this->_identifier = $identifier; - } - /** @private */ - public function __load() - { - if (!$this->__isInitialized__ && $this->_entityPersister) { - $this->__isInitialized__ = true; - - if (method_exists($this, "__wakeup")) { - // call this after __isInitialized__to avoid infinite recursion - // but before loading to emulate what ClassMetadata::newInstance() - // provides. - $this->__wakeup(); - } - - if ($this->_entityPersister->load($this->_identifier, $this) === null) { - throw new \Doctrine\ORM\EntityNotFoundException(); - } - unset($this->_entityPersister, $this->_identifier); - } - } - - /** @private */ - public function __isInitialized() - { - return $this->__isInitialized__; - } - - - public function getId() - { - if ($this->__isInitialized__ === false) { - return (int) $this->_identifier["id"]; - } - $this->__load(); - return parent::getId(); - } - - public function setUsrId($usrId) - { - $this->__load(); - return parent::setUsrId($usrId); - } - - public function getUsrId() - { - $this->__load(); - return parent::getUsrId(); - } - - public function setUser(\User_Adapter $user) - { - $this->__load(); - return parent::setUser($user); - } - - public function getUser(\Alchemy\Phrasea\Application $app) - { - $this->__load(); - return parent::getUser($app); - } - - public function setIsAware($isAware) - { - $this->__load(); - return parent::setIsAware($isAware); - } - - public function getIsAware() - { - $this->__load(); - return parent::getIsAware(); - } - - public function setIsConfirmed($isConfirmed) - { - $this->__load(); - return parent::setIsConfirmed($isConfirmed); - } - - public function getIsConfirmed() - { - $this->__load(); - return parent::getIsConfirmed(); - } - - public function setCanAgree($canAgree) - { - $this->__load(); - return parent::setCanAgree($canAgree); - } - - public function getCanAgree() - { - $this->__load(); - return parent::getCanAgree(); - } - - public function setCanSeeOthers($canSeeOthers) - { - $this->__load(); - return parent::setCanSeeOthers($canSeeOthers); - } - - public function getCanSeeOthers() - { - $this->__load(); - return parent::getCanSeeOthers(); - } - - public function setReminded($reminded) - { - $this->__load(); - return parent::setReminded($reminded); - } - - public function getReminded() - { - $this->__load(); - return parent::getReminded(); - } - - public function addData(\Entities\ValidationData $datas) - { - $this->__load(); - return parent::addData($datas); - } - - public function removeData(\Entities\ValidationData $datas) - { - $this->__load(); - return parent::removeData($datas); - } - - public function getDatas() - { - $this->__load(); - return parent::getDatas(); - } - - public function setSession(\Entities\ValidationSession $session = NULL) - { - $this->__load(); - return parent::setSession($session); - } - - public function getSession() - { - $this->__load(); - return parent::getSession(); - } - - public function isReleasable() - { - $this->__load(); - return parent::isReleasable(); - } - - - public function __sleep() - { - return array('__isInitialized__', 'id', 'usr_id', 'is_aware', 'is_confirmed', 'can_agree', 'can_see_others', 'reminded', 'datas', 'session'); - } - - public function __clone() - { - if (!$this->__isInitialized__ && $this->_entityPersister) { - $this->__isInitialized__ = true; - $class = $this->_entityPersister->getClassMetadata(); - $original = $this->_entityPersister->load($this->_identifier); - if ($original === null) { - throw new \Doctrine\ORM\EntityNotFoundException(); - } - foreach ($class->reflFields as $field => $reflProperty) { - $reflProperty->setValue($this, $reflProperty->getValue($original)); - } - unset($this->_entityPersister, $this->_identifier); - } - - } -} \ No newline at end of file diff --git a/lib/Doctrine/Repositories/OrderElementRepository.php b/lib/Doctrine/Repositories/OrderElementRepository.php index 424cd60c2f..0aa3eaed4b 100644 --- a/lib/Doctrine/Repositories/OrderElementRepository.php +++ b/lib/Doctrine/Repositories/OrderElementRepository.php @@ -17,7 +17,7 @@ class OrderElementRepository extends EntityRepository /** * Finds a FeedPublisher based on a given Feed and a User_Adapter. * - * @param Feed $feed + * @param Feed $feed * @param \User_Adapter $user * * @return FeedPublisher diff --git a/lib/Doctrine/Repositories/SessionRepository.php b/lib/Doctrine/Repositories/SessionRepository.php index cd2ee6832c..d4a5d8a268 100644 --- a/lib/Doctrine/Repositories/SessionRepository.php +++ b/lib/Doctrine/Repositories/SessionRepository.php @@ -4,6 +4,7 @@ namespace Repositories; use Alchemy\Phrasea\Application; use Doctrine\ORM\EntityRepository; +use Entities\Feed; /** * SessionRepository @@ -14,9 +15,9 @@ use Doctrine\ORM\EntityRepository; class SessionRepository extends EntityRepository { /** + * Returns all the feeds a user can access. * * @param User_Adapter $user - * * @return \Doctrine\Common\Collections\Collection */ public function getAllForUser(\User_Adapter $user) @@ -35,11 +36,15 @@ class SessionRepository extends EntityRepository ORDER BY f.updated_on DESC'; $query = $this->_em->createQuery($dql); - $feeds = $query->getResult(); - return $feeds; + return $query->getResult(); } + /** + * Returns all the public feeds. + * + * @return Collection + */ public function findAllPublic() { $dql = 'SELECT f FROM Entities\Feed f @@ -47,11 +52,18 @@ class SessionRepository extends EntityRepository ORDER BY f.updated_on DESC'; $query = $this->_em->createQuery($dql); - $feeds = $query->getResult(); - return $feeds; + return $query->getResult(); } + /** + * Returns the given feed if the user can access to it. + * + * @param Application $app + * @param \User_Adapter $user + * @param type $id + * @return Feed + */ public function loadWithUser(Application $app, \User_Adapter $user, $id) { $feed = $this->find($id); @@ -67,6 +79,12 @@ class SessionRepository extends EntityRepository return null; } + /** + * Returns all the feeds from a given array containing their id. + * + * @param array $feed_id + * @return Collection + */ public function findByIdArray(array $feed_id) { $dql = 'SELECT f FROM Entities\Feed f @@ -74,8 +92,7 @@ class SessionRepository extends EntityRepository WHERE f.id IN (' . implode(",", $feed_id) . ')'; $query = $this->_em->createQuery($dql); - $feeds = $query->getResult(); - return $feeds; + return $query->getResult(); } } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php index 4e05f601d5..3ddaac7e6f 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php @@ -5,11 +5,9 @@ namespace Alchemy\Tests\Phrasea\Controller\Root; require_once __DIR__ . '/../../../../../classes/FeedValidator.inc'; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Feed\Aggregate; use Entities\Feed; use Entities\FeedEntry; use Entities\FeedItem; -use Alchemy\Phrasea\Feed\FeedLink; use Symfony\Component\HttpFoundation\Response; class RssFeedTest extends \PhraseanetWebTestCaseAbstract diff --git a/tests/Alchemy/Tests/Phrasea/Feed/AggregateLinkGeneratorTest.php b/tests/Alchemy/Tests/Phrasea/Feed/AggregateLinkGeneratorTest.php index ad5e7424cc..8d58c0d815 100644 --- a/tests/Alchemy/Tests/Phrasea/Feed/AggregateLinkGeneratorTest.php +++ b/tests/Alchemy/Tests/Phrasea/Feed/AggregateLinkGeneratorTest.php @@ -52,8 +52,7 @@ class AggregateLinkGeneratorTest extends \PhraseanetPHPUnitAbstract if ($format == "atom") { $this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("AGGREGATE - Atom", $link->getTitle()); - } - elseif ($format == "rss") { + } elseif ($format == "rss") { $this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("AGGREGATE - RSS", $link->getTitle()); } diff --git a/tests/Alchemy/Tests/Phrasea/Feed/FeedLinkGeneratorTest.php b/tests/Alchemy/Tests/Phrasea/Feed/FeedLinkGeneratorTest.php index 90e417a925..20bd194795 100644 --- a/tests/Alchemy/Tests/Phrasea/Feed/FeedLinkGeneratorTest.php +++ b/tests/Alchemy/Tests/Phrasea/Feed/FeedLinkGeneratorTest.php @@ -44,8 +44,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract if ($format == "atom") { $this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("Title - Atom", $link->getTitle()); - } - elseif ($format == "rss") { + } elseif ($format == "rss") { $this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("Title - RSS", $link->getTitle()); } @@ -133,8 +132,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract if ($format == "atom") { $this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("Title - Atom", $link->getTitle()); - } - elseif ($format == "rss") { + } elseif ($format == "rss") { $this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("Title - RSS", $link->getTitle()); }