1

Getting a strange error when trying to check if a field is null when importing via FeedMe

Getting unknown property: craft\feedme\events\FieldEvent::fieldValue

use yii\base\Event;
use craft\feedme\events\FieldEvent;
use craft\feedme\events\ElementEvent;
use craft\helpers\ElementHelper;
use craft\elements\Entry;

Event::on(Fields::class, Fields::EVENT_AFTER_PARSE_FIELD, function(FieldEvent $event) {
    switch($event->feed['name']){
    case 'offers':
    if ($event->fieldHandle === 'merchants' && $event->fieldValue == null) {
    $event->isValid=false;
    }
    break;
}
});
2

It should be $event->parsedValue - see here - https://github.com/craftcms/feed-me/blob/develop/src/services/Fields.php#L225

  • Don't suppose you could help me with this error I'm now getting Setting unknown property: craft\feedme\events\FieldEvent::isValid - BaseObject.php: 163? – JMKelley Nov 26 '20 at 16:59
  • Is this in relation to your bountied post? If I understood correctly, I don’t think it’s doable with Feed Me as it is. – Oli Nov 26 '20 at 20:32
  • And in relation to this question, isValid is not available on this event. – Oli Nov 26 '20 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.