Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Improvement maybe: Fill any object you want. #2041

@didslm

Description

@didslm

Summary

I already did something in my project where it uses faker to fill objects and tries to guess the format if not it goes by the input type (int|string|bool) it works even with custom object.
There is already something inside for Doctrine entities but I couldn't find it for objects with some setters.
Btw this works only if the object has setters.

Self-enclosed code snippet for reproduction

To use it you just provide the object and it will fill it.
Example

$faker->fillObject($someObject, FILL_OPTIONAL_PARAMETERS);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions