@@ -64,8 +64,10 @@ abstract class Crud extends AbstractController
6464 /** @var EntityRepository<T> */
6565 protected EntityRepository $ repository ;
6666
67+ /** @var Fields<T> */
6768 protected Fields $ fields ;
6869
70+ /** @var Filters<T> */
6971 protected Filters $ filters ;
7072
7173 /** If the Crud is active and fully loaded */
@@ -332,7 +334,7 @@ public function toggleBooleanPostAction(Request $request, $entity): Response
332334 if (!$ this ->isEditableBoolean ($ entity )) {
333335 throw $ this ->createAccessDeniedException ("Entity {$ this ->getEntity ()} cannot be edited (boolean). " );
334336 }
335-
337+
336338 $ index = $ request ->request ->get ('index ' );
337339 $ value = $ request ->request ->getBoolean ('checked ' );
338340 $ propertyAccessor = PropertyAccess::createPropertyAccessor ();
@@ -661,6 +663,7 @@ protected function createNew(): object
661663
662664 /**
663665 * Overrides a form type. By default, forms are created using a custom formBuilder.
666+ * @param T $entity
664667 */
665668 protected function overrideFormType ($ entity , bool $ creation ): ?string
666669 {
@@ -770,6 +773,8 @@ protected function getFieldFetchMode(): string
770773
771774 /**
772775 * Fields that will be used to display the list of entities.
776+ *
777+ * @return Fields<T>
773778 */
774779 protected function getListingFields (): Fields
775780 {
@@ -778,6 +783,8 @@ protected function getListingFields(): Fields
778783
779784 /**
780785 * Fields that will be used to display the detail of an entity.
786+ *
787+ * @return Fields<T>
781788 */
782789 protected function getViewFields (): Fields
783790 {
@@ -786,6 +793,8 @@ protected function getViewFields(): Fields
786793
787794 /**
788795 * Fields that will be used for the export of an entity.
796+ *
797+ * @return Fields<T>
789798 */
790799 protected function getExportFields (): Fields
791800 {
@@ -794,12 +803,17 @@ protected function getExportFields(): Fields
794803
795804 /**
796805 * Fields that will be used to automatically generate the form in the create / edit actions.
806+ *
807+ * @return Fields<T>
797808 */
798809 protected function getFormFields (): Fields
799810 {
800811 return clone $ this ->fields ->filter (static fn (Field $ field ) => $ field ->isDisplayedInForm ());
801812 }
802813
814+ /**
815+ * @return Filters<T>
816+ */
803817 protected function getFilters (): Filters
804818 {
805819 return $ this ->filters ;
@@ -823,6 +837,8 @@ public function load(Request $request): void
823837
824838 /**
825839 * Creates a Fields object without any field by default
840+ *
841+ * @return Fields<T>
826842 */
827843 protected function createFields (): Fields
828844 {
@@ -831,6 +847,8 @@ protected function createFields(): Fields
831847
832848 /**
833849 * Creates a Fields object with default fields
850+ *
851+ * @return Fields<T>
834852 */
835853 protected function createFieldsFromMetadata (): Fields
836854 {
@@ -869,6 +887,9 @@ protected function createFieldsFromMetadata(): Fields
869887 return $ fields ;
870888 }
871889
890+ /**
891+ * @return Filters<T>
892+ */
872893 final protected function createFilters (): Filters
873894 {
874895 return new Filters ($ this ->metadata , $ this ->fieldService );
@@ -967,6 +988,7 @@ protected function createFilterForm(): FormBuilderInterface
967988 /**
968989 * All the actions that will generate Routes.
969990 * Every functions that end with "Actions" will be considered as an Action and thus, a new route will be automatically created.
991+ * @return array<string>
970992 */
971993 public function getAllActions (): array
972994 {
@@ -983,7 +1005,7 @@ public function getAllActions(): array
9831005
9841006 /**
9851007 * Finds the entity from an id.
986- * @return T
1008+ * @return T|null
9871009 */
9881010 public function guessEntity ()
9891011 {
@@ -1003,11 +1025,12 @@ public function getDescription(): string
10031025 }
10041026
10051027 /**
1006- * The default paginations options. Used to add a default sorting on the listing page.
1028+ * The default pagination options. Used to add a default sorting on the listing page.
1029+ * @param Fields<T> $fields
1030+ * @return array<string, string>
10071031 */
10081032 protected function getPaginationOptions (Fields $ fields ): array
10091033 {
1010- /** @var Fields|Field[] $fields */
10111034 foreach ($ fields as $ field ) {
10121035 if ($ field ->getDefaultSortDirection () !== null ) {
10131036 return ['defaultSortFieldName ' => 'e. ' . $ field ->getIndex (), 'defaultSortDirection ' => $ field ->getDefaultSortDirection ()];
@@ -1028,7 +1051,7 @@ protected function getPaginationOptions(Fields $fields): array
10281051 /**
10291052 * True by default
10301053 * If true, the responsive mode will be simplified, there won't be a table but a simple list that will display entity's toString().
1031- * This removes batch actions and fields informations .
1054+ * This removes batch actions and fields information .
10321055 * Return false to use a responsive table with more data instead.
10331056 */
10341057 protected function simpleResponsiveMode (): bool
@@ -1063,6 +1086,9 @@ protected function backUrl(): string
10631086 return $ this ->generateUrl ('qag. ' . $ this ->getRoute (), $ this ->getListRouteParams ());
10641087 }
10651088
1089+ /**
1090+ * @return array<string, mixed>
1091+ */
10661092 protected function getListRouteParams (): array
10671093 {
10681094 $ params = array_merge ($ this ->request ->query ->all (), $ this ->request ->get ('referer ' , []));
@@ -1072,6 +1098,7 @@ protected function getListRouteParams(): array
10721098
10731099 /**
10741100 * Checks if there are actions to display in the page, so the last column can be removed if there are not.
1101+ * @param array<int, Actions<int|string>> $actionEntities
10751102 */
10761103 protected function hasActions (array $ actionEntities ): bool
10771104 {
@@ -1096,6 +1123,7 @@ protected function hasQuickListQueryBuilderSecurity(): bool
10961123
10971124 /**
10981125 * Used to check if the entity is a part of the getListQueryBuilder
1126+ * @param T $entity
10991127 */
11001128 protected function entityIsInList ($ entity ): bool
11011129 {
@@ -1108,6 +1136,8 @@ protected function entityIsInList($entity): bool
11081136
11091137 /**
11101138 * Allows params overriding before twig rendering
1139+ * @param array<string, mixed> $params
1140+ * @return array<string, mixed>
11111141 */
11121142 protected function retrieveParams (string $ action , array $ params ): array
11131143 {
@@ -1118,6 +1148,9 @@ protected function retrieveParams(string $action, array $params): array
11181148 ], $ params );
11191149 }
11201150
1151+ /**
1152+ * @return array{0: bool, 1: string|null, 2: \Symfony\Component\Form\FormInterface|null, 3: int}
1153+ */
11211154 protected function applySearchAndFiltersQueryBuilder (Request $ request , QueryBuilder $ queryBuilder ): array
11221155 {
11231156 $ isSearchable = $ this ->isSearchable ();
0 commit comments