File tree Expand file tree Collapse file tree
templates/EasyAdminBundle/Fields Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,15 +200,25 @@ public function setType(string $type): self
200200 return $ this ;
201201 }
202202
203- public function getAdvisoryCount (): int
203+ /**
204+ * @return Collection<int, Advisory>
205+ */
206+ public function getAdvisories (): Collection
204207 {
205208 $ advisories = new ArrayCollection ();
206209 foreach ($ this ->installation ->getPackageVersions () as $ packageVersion ) {
207210 foreach ($ packageVersion ->getAdvisories () as $ advisory ) {
208- $ advisories ->add ($ advisory );
211+ if (!$ advisories ->contains ($ advisory )) {
212+ $ advisories ->add ($ advisory );
213+ }
209214 }
210215 }
211216
212- return $ advisories ->count ();
217+ return $ advisories ;
218+ }
219+
220+ public function getAdvisoryCount (): int
221+ {
222+ return $ this ->getAdvisories ()->count ();
213223 }
214224}
Original file line number Diff line number Diff line change 11{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
22{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
33{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
4- {% if field .formattedValue != 0 %}
4+ {% if ea().crud.currentAction == ' detail' %}
5+ {% set advisories = entity .instance .advisories %}
6+ {% if advisories | length > 0 %}
7+ <table class =" table table-sm table-borderless" >
8+ <thead >
9+ <tr >
10+ <th >Package</th >
11+ <th >CVE</th >
12+ <th >Title</th >
13+ </tr >
14+ </thead >
15+ <tbody >
16+ {% for advisory in advisories %}
17+ {% set url = ea_url()
18+ .unsetAll()
19+ .setController(' App\\Controller\\Admin\\AdvisoryCrudController' )
20+ .setAction(' detail' )
21+ .setEntityId(advisory .id ) %}
22+ <tr >
23+ <td >{{ advisory .package }}</td >
24+ <td ><a href =" {{ url }}" >{{ advisory .cve ?? advisory .advisoryId }}</a ></td >
25+ <td >{{ advisory .title }}</td >
26+ </tr >
27+ {% endfor %}
28+ </tbody >
29+ </table >
30+ {% endif %}
31+ {% elseif field .formattedValue != 0 %}
532 <span class =" badge badge-danger" >{{ field .formattedValue }}</span >
633{% endif %}
You can’t perform that action at this time.
0 commit comments