Pls help me find working example of managed_file in core

I’m trying to adapt a simple CRUD form in an older D7 module into D8. Everything is looking OK as far as a form and saving data except managed_file which is not in Examples that I can find.

OK, let’s load up a fresh D8 and start poking around in core, surely there’s a working example in there. That said, trying to find it in core is where I’m needing help.

I’ve followed the example here but it’s failing to pass the object. So let’s find one in core.

Normally, I would find a page that has it and then use routing to find where it’s invoked. I find managed_file working in /user/{id}/edit

OK, let’s look in core/modules/user/

I’m told that Forms don’t necessarily have Controllers, so let’s look in the src/Form/ None of those pertain to the settings or editing a User form that I can determine.

Failing that, poking around I find src/AccountSettingsForm.php. Surely, managed_file is included there? No, lots of useful form elements but no mention of the picture in this form.

Perhaps src/AccountForm.php? Nothing of what I’m searching for, but I see in the create function it seems to get a container called ‘entity.manager’. I see it extends ContentEntityForm so let’s check there despite the fact “Picture” is an esoteric field and wouldn’t be in the Parent form. Nope, it’s not found there either. In my reading, I seem to understand that a lot of redundant functions, methods are in containers. Is that the same as services? Reading I see that EntityManager is in core/lib/Drupal/core/Entity. Seems very high level, so I check EntityForm.php in that same directory. Nope, no mention of the Picture field there either.

Looking at src/Controller/UserController.php there’s another container->get(‘’). OK, looking at service containers in the above api page I see nothing about which makes me think I’m looking in the wrong place.

So, I’ve looked at a dozen files, within the core/modules/user/ directory and several of its parents but feel I’m no more closer to finding an example of managed_file that works so that I can get back to why my first D8 module is failing. How would you find an example of managed_file, perhaps within User?

Drupal version: