Skip to content

Instantly share code, notes, and snippets.

@hailwood
Created February 3, 2015 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hailwood/48affcd5869d0cd4c225 to your computer and use it in GitHub Desktop.
Save hailwood/48affcd5869d0cd4c225 to your computer and use it in GitHub Desktop.
<?php
$config = new GridFieldConfig_RelationEditor();
$fields->addFieldToTab('Root.SomeHasManyRelation', new GridField($field, null, $this->SomeHasManyRelation(), $config));
@hailwood
Copy link
Author

hailwood commented Feb 3, 2015

Dump of $this->SomeHasManyRelation()->toArray() (SomeHasManyRelation is GalleryImages in this case).

Array
(
[0] => GalleryImage Object
(
[destroyed] =>
[model:protected] => DataModel Object
(
[customDataLists:protected] => Array
(
)

            )

        [record:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:14:06
                [LastEdited] => 2014-12-10 15:34:57
                [SortOrder] => 3
                [ImageID] => 27
                [PageID] => 2
                [ID] => 15
                [RecordClassName] => GalleryImage
            )

        [changed:DataObject:private] => Array
            (
            )

        [original:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:14:06
                [LastEdited] => 2014-12-10 15:34:57
                [SortOrder] => 3
                [ImageID] => 27
                [PageID] => 2
                [ID] => 15
                [RecordClassName] => GalleryImage
            )

        [brokenOnDelete:protected] => 
        [brokenOnWrite:protected] => 
        [components:protected] => 
        [unsavedRelations:protected] => 
        [sourceQueryParams:protected] => Array
            (
                [Foreign.ID] => 2
                [Foreign.Filter] => "PageID" = '2'
            )

        [failover:protected] => 
        [customisedObject:protected] => 
        [objCache:ViewableData:private] => Array
            (
            )

        [class] => GalleryImage
        [extension_instances:protected] => Array
            (
            )

        [beforeExtendCallbacks:protected] => Array
            (
            )

        [afterExtendCallbacks:protected] => Array
            (
            )

    )

[1] => GalleryImage Object
    (
        [destroyed] => 
        [model:protected] => DataModel Object
            (
                [customDataLists:protected] => Array
                    (
                    )

            )

        [record:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:14:27
                [LastEdited] => 2014-12-15 16:53:02
                [Title] => Ellen Jessie Bird and Robert Henry Bird
                [SortOrder] => 4
                [ImageID] => 29
                [PageID] => 2
                [ID] => 16
                [RecordClassName] => GalleryImage
            )

        [changed:DataObject:private] => Array
            (
            )

        [original:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:14:27
                [LastEdited] => 2014-12-15 16:53:02
                [Title] => Ellen Jessie Bird and Robert Henry Bird
                [SortOrder] => 4
                [ImageID] => 29
                [PageID] => 2
                [ID] => 16
                [RecordClassName] => GalleryImage
            )

        [brokenOnDelete:protected] => 
        [brokenOnWrite:protected] => 
        [components:protected] => 
        [unsavedRelations:protected] => 
        [sourceQueryParams:protected] => Array
            (
                [Foreign.ID] => 2
                [Foreign.Filter] => "PageID" = '2'
            )

        [failover:protected] => 
        [customisedObject:protected] => 
        [objCache:ViewableData:private] => Array
            (
            )

        [class] => GalleryImage
        [extension_instances:protected] => Array
            (
            )

        [beforeExtendCallbacks:protected] => Array
            (
            )

        [afterExtendCallbacks:protected] => Array
            (
            )

    )

[2] => GalleryImage Object
    (
        [destroyed] => 
        [model:protected] => DataModel Object
            (
                [customDataLists:protected] => Array
                    (
                    )

            )

        [record:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:16:08
                [LastEdited] => 2014-12-15 16:40:41
                [Title] => Nathan Bird
                [SortOrder] => 5
                [ImageID] => 96
                [PageID] => 2
                [ID] => 18
                [RecordClassName] => GalleryImage
            )

        [changed:DataObject:private] => Array
            (
            )

        [original:protected] => Array
            (
                [ClassName] => GalleryImage
                [Created] => 2014-12-10 15:16:08
                [LastEdited] => 2014-12-15 16:40:41
                [Title] => Nathan Bird
                [SortOrder] => 5
                [ImageID] => 96
                [PageID] => 2
                [ID] => 18
                [RecordClassName] => GalleryImage
            )

        [brokenOnDelete:protected] => 
        [brokenOnWrite:protected] => 
        [components:protected] => 
        [unsavedRelations:protected] => 
        [sourceQueryParams:protected] => Array
            (
                [Foreign.ID] => 2
                [Foreign.Filter] => "PageID" = '2'
            )

        [failover:protected] => 
        [customisedObject:protected] => 
        [objCache:ViewableData:private] => Array
            (
            )

        [class] => GalleryImage
        [extension_instances:protected] => Array
            (
            )

        [beforeExtendCallbacks:protected] => Array
            (
            )

        [afterExtendCallbacks:protected] => Array
            (
            )

    )

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment