@@ -296,6 +296,39 @@ abstract class AbstractColumn implements ColumnInterface
296296 * @var bool
297297 */
298298 protected $ sentInResponse ;
299+
300+ /**
301+ * If this column displays the total of its cells in its head
302+ * Default: false.
303+ *
304+ * @var bool
305+ */
306+ protected $ computeTotal ;
307+
308+ /**
309+ * Contains the eventually computed total of the column.
310+ *
311+ * @var mixed
312+ */
313+ protected $ total ;
314+
315+ /**
316+ * If the column represents a real column in the database.
317+ *
318+ * @var bool
319+ */
320+ protected $ mapped ;
321+
322+ /**
323+ * Force the association property.
324+ */
325+ protected $ isAssociation ;
326+
327+ /**
328+ * The source of data, if different from title and no dql specified.
329+ */
330+ protected $ dataSource ;
331+
299332 //-------------------------------------------------
300333 // Options
301334 //-------------------------------------------------
@@ -326,6 +359,10 @@ public function configureOptions(OptionsResolver $resolver)
326359 'type_of_field ' => null ,
327360 'responsive_priority ' => null ,
328361 'sent_in_response ' => true ,
362+ 'compute_total ' => false ,
363+ 'mapped ' => true ,
364+ 'is_association ' => false ,
365+ 'data_source ' => null ,
329366 ]);
330367
331368 $ resolver ->setAllowedTypes ('cell_type ' , ['null ' , 'string ' ]);
@@ -347,6 +384,10 @@ public function configureOptions(OptionsResolver $resolver)
347384 $ resolver ->setAllowedTypes ('type_of_field ' , ['null ' , 'string ' ]);
348385 $ resolver ->setAllowedTypes ('responsive_priority ' , ['null ' , 'int ' ]);
349386 $ resolver ->setAllowedTypes ('sent_in_response ' , ['bool ' ]);
387+ $ resolver ->setAllowedTypes ('compute_total ' , ['bool ' ]);
388+ $ resolver ->setAllowedTypes ('mapped ' , ['bool ' ]);
389+ $ resolver ->setAllowedTypes ('is_association ' , ['bool ' ]);
390+ $ resolver ->setAllowedTypes ('data_source ' , ['string ' , 'null ' ]);
350391
351392 $ resolver ->setAllowedValues ('cell_type ' , [null , 'th ' , 'td ' ]);
352393 $ resolver ->setAllowedValues ('join_type ' , [null , 'join ' , 'leftJoin ' , 'innerJoin ' ]);
@@ -392,6 +433,10 @@ public function isAssociation()
392433 */
393434 public function isToManyAssociation ()
394435 {
436+ if ($ this ->isAssociation ) {
437+ return true ;
438+ }
439+
395440 if (true === $ this ->isAssociation () && null !== $ this ->typeOfAssociation ) {
396441 if (\in_array (ClassMetadataInfo::ONE_TO_MANY , $ this ->typeOfAssociation , true ) || \in_array (ClassMetadataInfo::MANY_TO_MANY , $ this ->typeOfAssociation , true )) {
397442 return true ;
@@ -430,9 +475,9 @@ public function addDataToOutputArray(array &$row)
430475 /**
431476 * {@inheritdoc}
432477 */
433- public function renderCellContent (array &$ row )
478+ public function renderCellContent (array &$ row, array & $ resultRow )
434479 {
435- $ this ->isToManyAssociation () ? $ this ->renderToMany ($ row ) : $ this ->renderSingleField ($ row );
480+ $ this ->isToManyAssociation () ? $ this ->renderToMany ($ row, $ resultRow ) : $ this ->renderSingleField ($ row, $ resultRow );
436481 }
437482
438483 /**
@@ -976,8 +1021,6 @@ public function setTypeOfAssociation($typeOfAssociation)
9761021 }
9771022
9781023 /**
979- * Add a typeOfAssociation.
980- *
9811024 * @param int $typeOfAssociation
9821025 *
9831026 * @return $this
@@ -1028,4 +1071,122 @@ public function setSentInResponse($sentInResponse)
10281071
10291072 return $ this ;
10301073 }
1074+
1075+ /**
1076+ * Get computeTotal.
1077+ *
1078+ * @return bool
1079+ */
1080+ public function getComputeTotal ()
1081+ {
1082+ return $ this ->computeTotal ;
1083+ }
1084+
1085+ /**
1086+ * Set sentIntResponse.
1087+ *
1088+ * @param bool $computeTotal
1089+ *
1090+ * @return $this
1091+ */
1092+ public function setComputeTotal ($ computeTotal )
1093+ {
1094+ $ this ->computeTotal = $ computeTotal ;
1095+
1096+ return $ this ;
1097+ }
1098+
1099+ /**
1100+ * Get total.
1101+ */
1102+ public function getTotal ()
1103+ {
1104+ return $ this ->total ;
1105+ }
1106+
1107+ /**
1108+ * Set total.
1109+ *
1110+ * @param $total
1111+ *
1112+ * @return $this
1113+ */
1114+ public function setTotal ($ total )
1115+ {
1116+ $ this ->total = $ total ;
1117+
1118+ return $ this ;
1119+ }
1120+
1121+ /**
1122+ * Get mapped.
1123+ *
1124+ * @return bool
1125+ */
1126+ public function getMapped ()
1127+ {
1128+ return $ this ->mapped ;
1129+ }
1130+
1131+ /**
1132+ * Set mapped.
1133+ *
1134+ * @param bool $mapped
1135+ *
1136+ * @return $this
1137+ */
1138+ public function setMapped ($ mapped )
1139+ {
1140+ $ this ->mapped = $ mapped ;
1141+
1142+ return $ this ;
1143+ }
1144+
1145+ /**
1146+ * Get isAssociation.
1147+ *
1148+ * @return bool
1149+ */
1150+ public function getIsAssociation ()
1151+ {
1152+ return $ this ->isAssociation ;
1153+ }
1154+
1155+ /**
1156+ * Set isAssociation.
1157+ *
1158+ * @param bool $isAssociation
1159+ *
1160+ * @return $this
1161+ */
1162+ public function setIsAssociation ($ isAssociation )
1163+ {
1164+ $ this ->isAssociation = $ isAssociation ;
1165+
1166+ return $ this ;
1167+ }
1168+
1169+ /**
1170+ * Get data source.
1171+ *
1172+ * @return string|null
1173+ */
1174+ public function getDataSource ()
1175+ {
1176+ return $ this ->isAssociation ;
1177+ }
1178+
1179+ /**
1180+ * Set data source.
1181+ *
1182+ * @param string|null $dataSource
1183+ *
1184+ * @return $this
1185+ */
1186+ public function setDataSource ($ dataSource )
1187+ {
1188+ $ this ->dataSource = $ dataSource ;
1189+
1190+ return $ this ;
1191+ }
10311192}
0 commit comments