Giter Site home page Giter Site logo

Comments (5)

mythicallage avatar mythicallage commented on May 24, 2024 1

In my opinion, it looks pretty good. I don't see any better way to fix it. Thank you so much.

from yii2-save-relations-behavior.

juban avatar juban commented on May 24, 2024

Yes, you are right, it could totally be useful in a debugging context.
I'm thinking of adding a Yii:warning() log specifying the exception class name and message.
What do you think ?

from yii2-save-relations-behavior.

juban avatar juban commented on May 24, 2024

I have pushed an updated version of the saveRelatedRecords method into the master branch.
Could you test it and let me know if you have any issue?
Thanks.

from yii2-save-relations-behavior.

mythicallage avatar mythicallage commented on May 24, 2024

Thank you. It was useful to find my mistake.

I was looking for improvements to save related models, but it is not as easy as I wanted. The main problem is that how to define an independent model and save it to avoid double saving attempts. I can't see any hint in \yii\db\BaseActiveRecord::getRelation, \yii\db\BaseActiveRecord::link.

e. g.
MainActiveRecord hasOne SubordinateActiveRecord.
Primary Key of MainActiveRecord is auto incremented.
I expected an attempt to save SubordinateActiveRecord after BaseActiveRecord::EVENT_AFTER_INSERT or EVENT_AFTER_UPDATE. But we have to run saving it twice for the universality of behavior.

from yii2-save-relations-behavior.

juban avatar juban commented on May 24, 2024

Upcoming 1.3.0 release will hopefully cover that more gracefully.
Your feedback is appreciated.

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.