damian_nz - 2 months ago

Hi there, I am trying to add the following migration to an existing stream.

    protected $fields = [
        'group'   => [
            'type'   => 'anomaly.field_type.relationship',
            'config' => [
                'column_type' => 'integer',
                'related'     => 'MyNamespace\MyModule\Filter\FilterModel',
                'handler'     => 'MyNamespace\MyModule\Filter\Handler\PopulateFilterOptions@customGrouping'
            ]
        ],
    ];

When I try to compile or refresh the streams after running the migration I get the following error.

Call to a member function getSlug() on null
() at /vagrant/cms/vendor/anomaly/streams-platform/src/Assignment/AssignmentModel.php:127

This is the getFieldSlug function. Is there something missing from my config for the new field?

Answer

damian_nz - 2 months ago

I figured it out Ryan :guilty: (not sure what that emoji would look like)

So in my handler I was type hinting the wrong field type. The error message sent me looking in the wrong place :)

Thank you for your time

ryanthompson - 2 months ago

Did you assign it? The field will really only put it into the field pool for the namespace.

damian_nz - 2 months ago

Yeah I have

    protected $assignments = [
        'group'
    ];

in the migration also

damian_nz - 2 months ago

I figured it out Ryan :guilty: (not sure what that emoji would look like)

So in my handler I was type hinting the wrong field type. The error message sent me looking in the wrong place :)

Thank you for your time

ryanthompson - 2 months ago

Lol all good! I have emojis staged locally by the way :-) along with a ton of other goodies