Giter Site home page Giter Site logo

Comments (3)

juban avatar juban commented on May 27, 2024

Hi @phrakon,

I'm afraid that won't be possible because setting a relation value is done through PHP magic setters.
Setting new relations that way won't work due to PHP limitations.
However, you could workaround that doing something like:

$emails = $model->emails;
$emails[] = '[email protected]';
$emails[] = '[email protected]';
$model->emails = $emails;

Another possibility would be to create a new method that could do that. I will think about it.

Thanks.

from yii2-save-relations-behavior.

phrakon avatar phrakon commented on May 27, 2024

It's so strange. I was doing the same behavior via ArrayObject. And it worked...

from yii2-save-relations-behavior.

juban avatar juban commented on May 27, 2024

@phrakon I'm curious about ArrayObject. Could you elaborate a bit? How would you do that exactly?

from yii2-save-relations-behavior.

Related Issues (20)

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.