@@ -88,13 +88,17 @@ public function renderSingleField(array &$row)
8888 {
8989 $ path = Helper::getDataPropertyPath ($ this ->data );
9090
91- if (true === $ this ->isEditableContentRequired ($ row )) {
92- $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ path ), $ row [$ this ->editable ->getPk ()]);
93- } else {
94- $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ path ));
95- }
91+ if ($ this ->accessor ->isReadable ($ row , $ path )) {
92+
93+ if (true === $ this ->isEditableContentRequired ($ row )) {
94+ $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ path ), $ row [$ this ->editable ->getPk ()]);
95+ } else {
96+ $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ path ));
97+ }
9698
97- $ this ->accessor ->setValue ($ row , $ path , $ content );
99+ $ this ->accessor ->setValue ($ row , $ path , $ content );
100+
101+ }
98102
99103 return $ this ;
100104 }
@@ -107,27 +111,31 @@ public function renderToMany(array &$row)
107111 $ value = null ;
108112 $ path = Helper::getDataPropertyPath ($ this ->data , $ value );
109113
110- $ entries = $ this ->accessor ->getValue ($ row , $ path );
111-
112- if (count ($ entries ) > 0 ) {
113- foreach ($ entries as $ key => $ entry ) {
114- $ currentPath = $ path .'[ ' .$ key .'] ' .$ value ;
115- $ currentObjectPath = Helper::getPropertyPathObjectNotation ($ path , $ key , $ value );
116-
117- if (true === $ this ->isEditableContentRequired ($ row )) {
118- $ content = $ this ->renderTemplate (
119- $ this ->accessor ->getValue ($ row , $ currentPath ),
120- $ row [$ this ->editable ->getPk ()],
121- $ currentObjectPath
122- );
123- } else {
124- $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ currentPath ));
125- }
114+ if ($ this ->accessor ->isReadable ($ row , $ path )) {
126115
127- $ this ->accessor ->setValue ($ row , $ currentPath , $ content );
116+ $ entries = $ this ->accessor ->getValue ($ row , $ path );
117+
118+ if (count ($ entries ) > 0 ) {
119+ foreach ($ entries as $ key => $ entry ) {
120+ $ currentPath = $ path . '[ ' . $ key . '] ' . $ value ;
121+ $ currentObjectPath = Helper::getPropertyPathObjectNotation ($ path , $ key , $ value );
122+
123+ if (true === $ this ->isEditableContentRequired ($ row )) {
124+ $ content = $ this ->renderTemplate (
125+ $ this ->accessor ->getValue ($ row , $ currentPath ),
126+ $ row [$ this ->editable ->getPk ()],
127+ $ currentObjectPath
128+ );
129+ } else {
130+ $ content = $ this ->renderTemplate ($ this ->accessor ->getValue ($ row , $ currentPath ));
131+ }
132+
133+ $ this ->accessor ->setValue ($ row , $ currentPath , $ content );
134+ }
135+ } else {
136+ // no placeholder - leave this blank
128137 }
129- } else {
130- // no placeholder - leave this blank
138+
131139 }
132140
133141 return $ this ;
@@ -138,7 +146,7 @@ public function renderToMany(array &$row)
138146 */
139147 public function getCellContentTemplate ()
140148 {
141- return 'SgDatatablesBundle: render: boolean.html.twig ' ;
149+ return '@SgDatatables/ render/ boolean.html.twig ' ;
142150 }
143151
144152 /**
@@ -148,7 +156,7 @@ public function renderPostCreateDatatableJsContent()
148156 {
149157 if ($ this ->editable instanceof EditableInterface) {
150158 return $ this ->twig ->render (
151- 'SgDatatablesBundle: column: column_post_create_dt.js.twig ' ,
159+ '@SgDatatables/ column/ column_post_create_dt.js.twig ' ,
152160 array (
153161 'column_class_editable_selector ' => $ this ->getColumnClassEditableSelector (),
154162 'editable_options ' => $ this ->editable ,
@@ -336,7 +344,7 @@ public function setFalseLabel($falseLabel)
336344 private function renderTemplate ($ data , $ pk = null , $ path = null )
337345 {
338346 $ renderVars = array (
339- 'data ' => $ data ,
347+ 'data ' => $ this -> isCustomDql () && in_array ( $ data , array ( 0 , 1 , ' 0 ' , ' 1 ' ), true ) ? boolval ( $ data ) : $ data ,
340348 'default_content ' => $ this ->getDefaultContent (),
341349 'true_label ' => $ this ->trueLabel ,
342350 'true_icon ' => $ this ->trueIcon ,
0 commit comments