Browse Source

Updating code to reflect discussion in Pull Request 174

Jérôme poskin 12 years ago
parent
commit
3351c3e8ec

+ 4 - 4
src/Packagist/WebBundle/Controller/WebController.php

@@ -281,7 +281,7 @@ class WebController extends Controller
         $id = $package->getId();
 
         try {
-            /** @var $redis Redis */
+            /** @var $redis \Snc\RedisBundle\Client\Phpredis\Client */
             $redis = $this->get('snc_redis.default');
             $counts = $redis->mget('dl:'.$id, 'dl:'.$id.':'.date('Ym'), 'dl:'.$id.':'.date('Ymd'));
             $data['downloads'] = array(
@@ -410,11 +410,11 @@ class WebController extends Controller
 
     protected function createDeletePackageForm()
     {
-        if (!$this->get('security.context')->isGranted('ROLE_DELETE_PACKAGES')) {
-            throw new AccessDeniedException;
+        if ($this->get('security.context')->isGranted('ROLE_DELETE_PACKAGES')) {
+            return $this->createFormBuilder(array())->getForm();
         }
 
-        return $this->createFormBuilder(array())->getForm();
+        return false;
     }
 
     /**

+ 1 - 1
src/Packagist/WebBundle/Entity/PackageLink.php

@@ -38,7 +38,7 @@ abstract class PackageLink
      */
     private $packageVersion;
 
-    protected $version;
+    private $version;
 
     public function toArray()
     {

+ 0 - 3
src/Packagist/WebBundle/Entity/Tag.php

@@ -15,7 +15,6 @@ namespace Packagist\WebBundle\Entity;
 use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;
 use Doctrine\Common\Collections\Collection;
-
 use Doctrine\ORM\EntityManager;
 
 /**
@@ -49,8 +48,6 @@ class Tag
     }
 
     /**
-     * @static
-     *
      * @param \Doctrine\ORM\EntityManager $em
      * @param                             $name
      * @param bool                        $create

+ 8 - 9
src/Packagist/WebBundle/Entity/Version.php

@@ -15,7 +15,6 @@ namespace Packagist\WebBundle\Entity;
 use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;
 use Doctrine\Common\Collections\ArrayCollection;
-
 use Composer\Package\Version\VersionParser;
 
 /**
@@ -581,7 +580,7 @@ class Version
     /**
      * Get tags
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection $tags
+     * @return \Doctrine\Common\Collections\Collection $tags
      */
     public function getTags()
     {
@@ -611,7 +610,7 @@ class Version
     /**
      * Get authors
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getAuthors()
     {
@@ -739,7 +738,7 @@ class Version
     /**
      * Get require
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getRequire()
     {
@@ -759,7 +758,7 @@ class Version
     /**
      * Get replace
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getReplace()
     {
@@ -779,7 +778,7 @@ class Version
     /**
      * Get conflict
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getConflict()
     {
@@ -799,7 +798,7 @@ class Version
     /**
      * Get provide
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getProvide()
     {
@@ -819,7 +818,7 @@ class Version
     /**
      * Get devRequire
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getDevRequire()
     {
@@ -839,7 +838,7 @@ class Version
     /**
      * Get suggest
      *
-     * @return \Doctrine\Common\Collections\ArrayCollection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getSuggest()
     {

+ 1 - 1
src/Packagist/WebBundle/Package/Updater.php

@@ -150,7 +150,7 @@ class Updater
         $em->flush();
     }
 
-    private function updateInformation(PackageInterface $package, PackageInterface $data, $flags)
+    private function updateInformation(Package $package, PackageInterface $data, $flags)
     {
         $em = $this->doctrine->getEntityManager();
         $version = new Version();

+ 1 - 1
src/Packagist/WebBundle/Resources/views/layout.html.twig

@@ -99,7 +99,7 @@
         </footer>
 
         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
-        <script>!window.jQuery && document.write(encodeURI('%3Cscript src="/js/libs/jquery-1.5.2.min.js"%3E%3C/script%3E'))</script>
+        <script>!window.jQuery && document.write(unescape('%3Cscript src="/js/libs/jquery-1.5.2.min.js"%3E%3C/script%3E'))</script>
         <script src="{{ asset('js/libs/humane.min.js') }}"></script>
         <script src="{{ asset('bundles/packagistweb/js/layout.js') }}"></script>
         <script src="{{ asset('bundles/packagistweb/js/search.js')}}"></script>