7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Nested DataObjects and summary fields
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 408 Views |
-
Nested DataObjects and summary fields

5 February 2012 at 10:07am Last edited: 5 February 2012 10:08am
Hello everyone !
I have a class Commande extending ModelAdmin.
In Commande exists a nested DataObject called NumeroColis (1 field : 'Numero'). I'm using the wonderful DOManager to handle it and it's perfect.BUT :
When clicking the "Search" button, to show all the existing Commandes, I'd like to add a column called Numeros and for each Commande, show a list of the recorded NumeroColis.
This is what I did in Commande.php :
public function getListeNumeros() {
$rawlist = DataObject::get('NumeroColis','CommandeID = '.$this->ID);
$nums = $rawlist->column('Numero');
$liste = implode(', ', $nums);
if (isset($liste)) {
return $liste;
} else {
return "Pas de colis";
}
}static $summary_fields = array(
...
'ListeNumeros' => 'Numéros',
...
);I get a Internal Server Error when clicking the Search button... and I spent a lot of time on this, so I decided to ask the great SStripe international community ! Anyone ?
-
Re: Nested DataObjects and summary fields

2 April 2012 at 1:27am Last edited: 2 April 2012 1:27am
Thanks to the messages answering my tweet, I got a little further in my search :
Writing
instead ofexit($liste);
actually shows me the list of the Colis for my first Commande.return $liste;
The Firebug Console is not helping, for it just says NetworkError : Internal Error 500 in mysite/admin/.../SearchForm
Maybe there's something to reset between two iterations ?
-
Re: Nested DataObjects and summary fields

2 April 2012 at 3:41am
Update : Enabling error logging in htaccess brought me this information
(thanks simon !)Fatal error: Call to a member function column() on a non-object
| 408 Views | ||
|
Page:
1
|
Go to Top |

