MultipleFieldType Handler
Created 6 years ago by jcastillotx

I am trying to push only records that are not sponsored. So I declare my custom handler in my migration

‘sponsorship_child’          => [
                ‘type’   => ‘anomaly.field_type.multiple’,
                ‘config’ => [
                    ‘related’    => ChildModel::class,
                    ‘title_name’ => ‘name’,
                    ‘mode’       => ‘lookup’,
                    ‘handler’    => ‘Modules\SponsorshipsModule\Sponsorship\Support\MultipleFieldType\ChildMultiHandler@handle’

My custom handler

<?php namespace Modules\SponsorshipsModule\Sponsorship\Support\MultipleFieldType;

use Anomaly\MultipleFieldType\MultipleFieldType;
use Modules\SponsorshipsModule\Child\Contract\ChildRepositoryInterface;

 * Class ChildMultiHandler
 * @package Modules\SponsorshipsModule\Sponsorship\Support\MultipleFieldType
class ChildMultiHandler {

     * @param \Anomaly\MultipleFieldType\MultipleFieldType                        $fieldType
     * @param \Modules\SponsorshipsModule\Child\Contract\ChildRepositoryInterface $children
    public function handle(MultipleFieldType $fieldType, ChildRepositoryInterface $children) {



I am not getting anything I want.

ryanthompson  —  6 years ago

I'll have to check it out. Looks like a bug.

william  —  6 years ago

Did you solve this @jcastillotx @ryanthompson ?

I am having this problem myself, and the question is: Should we even use handler for lookup? I mean that handle method doesn't even get hit with lookup mode. But if you choose tags it does.

ryanthompson  —  6 years ago

If you guys are trying to do this with the lookup method you will need to use the lookup table builder to do your "handling":

william  —  6 years ago

I think i need more help here.

Let's say i have an addon, where the client should be able to pick a user. Meaning this multi relation field is related to user model. If i understand things correctly. I can't really depend on automatic detection since i would place this tablebuilder file in Support/MultipleFieldType within users. So i guess i would then define the hook on... the usermodel? Do i extend that?

What about the lookup_table key in the configuration. Not seeing this right now, but it might be because its way too late for this. But any help is appreciated @ryanthompson