Giter VIP home page Giter VIP logo

data-transfer-object-dto's People

Contributors

aedart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

data-transfer-object-dto's Issues

Processing 1:n relations

Hi,
I'd like to ask if I can use this package for instances that use 1:n relations. In other words, I don't have single Address but array or Laravel collection of addresses.

I manage to test it with something like this:

    public function setTranslations(Array $translations)
    {
        $this->translations = collect($translations)->map(function ($translation) {
            return new RouteTranslation($translation);
        });
    }

In this case standard DTO->toArray() won't work with nested collection.
I used collect just to have easier access for those DTO's later

Do you have any thoughts about this kind of use case?

dynamically "generating" properties

Hey there,

i am just playing around with your package - nice idea so far. However, i stumbled upon a question, i wasn't able to answer myself..

Is it possible to "dynamically" generate properties in a DTO? For example, i want to have one GenericDTO that automatically assigns key/value pairs..

However, if I call

$dto = new GenericDTO(['foo' => 'bar', ...]);`

i get an error, that foo is not defined or inaccessible.. Which is true, because my GenericDTO does not have such a property..

In other words, is it possible to append properties dynamically? If yes, how? ;)
Thanks a lot for your time / effort!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.