Git Product home page Git Product logo

Comments (4)

DarKDinDoN avatar DarKDinDoN commented on August 20, 2024

What about the associate method ?

Example :
I update or create a random model. I want to associate a random relation to this model.

Because there is no before hook, I would do this :

// Update the model    
$model = $modelRepository->update(
    $attributes,
    $modelId
);

// Associate a model
$model->relation()->associate($relation);

// And then again save
$model->save();

This will make two queries, when we can make one. (like for issue #75 )

EDIT : to be clear, we could associate the model in a beforeUpdate() method and avoid the second query.

from l5-repository.

 avatar commented on August 20, 2024

+1

from l5-repository.

andersao avatar andersao commented on August 20, 2024

I've been very busy in recent months with my work projects, which eventually pulling away of my personal projects, so it could not provide the necessary support to you, I am more relaxed now and I'm checking all the issues in order to work on fixes and new implementations, apologize to everyone.

from l5-repository.

cdarken avatar cdarken commented on August 20, 2024

How about passing also the object in the state before the update to RepositoryEntityUpdated event ?
Like on the delete event.
Would help a lot with testing since the native model events are not triggered when running tests.

from l5-repository.

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.