src/Entity/Factory/FileFactory.php
public function entity(array $data = [])
    {
        $userFactory = new UserFactory();
        $file = new File();
        $file->account = $userFactory->entity($data['account']);
        unset($data['account']);

        foreach ($data as $key => $value) {
            $property = Inflector::variable($key);
            $file->$property = $value;
        }

        return $file;
    }
public function entity(array $data = [])
    {
        $userFactory = new UserFactory();
        $file = new File();
        $file->account = $userFactory->entity($data['account']);
        unset($data['account']);

        foreach ($data as $key => $value) {
            $property = Inflector::variable($key);
            $file->$property = $value;
        }

        return $file;
    }
@param array $data

@return File