Coder Social home page Coder Social logo

Comments (11)

duellsy avatar duellsy commented on July 25, 2024

Hmm, a very valid issue, will have a look into it. Thanks.

from revisionable.

mmodler avatar mmodler commented on July 25, 2024

Thanks for your reply!
I think adding a "relatedmodel" field/colum to Revision and populate it onSave with the related models name/namespace will do it?

Then you'll also make custom foreign key names working. Atm. related model Foo with foreign key name fooBar_id would resolve to Model "FooBar" in Revisionable...

from revisionable.

mmodler avatar mmodler commented on July 25, 2024

Hi duellsy,

i appreciate your work on revisionable. The next days i have to get revisionable working completely in my app, so i would like to ask you about your plans with revisionable? Do you have time to maintain and improve it atm?

Because there are two forks with improvements and i need to decide what i use in my app. I would prefer to use "the original one" if i know the projekt is active. I could try to solve the foreign key issue and make a pull request (would be my first one) if you like?

from revisionable.

duellsy avatar duellsy commented on July 25, 2024

Hey @mmodler, yeah the project is definitely active and I've contacted the authors of the other forks and mentioned that they should be submitting pull requests to keep the project in the one direction.

All for you submitting a pull request with a fix, just been flat out myself recently, apologies for that.

from revisionable.

duellsy avatar duellsy commented on July 25, 2024

Currently working on a solution, have a working update but want to test it a little more to make sure its backwards compatible. I'll get you to test also before a full release if that's cool

from revisionable.

duellsy avatar duellsy commented on July 25, 2024

Hey @mmodler can you test this update with your app to check that all is in order, before I tag and release to production?

Might need to update your composer to use the dev version:

"venturecraft/revisionable": "dev-develop"

from revisionable.

mmodler avatar mmodler commented on July 25, 2024

Hi duellsy, i will test it now. Its a little more elegant than my quick and dirty fix which extracted the namespace from revisions_type.

from revisionable.

mmodler avatar mmodler commented on July 25, 2024

It seems to work like a charm. I have one issue with a foreign key named foo_bar_id, i will have to rename it to foobar_id so the model coluld resolved.

Why do you prefer throwing exeptions instead of returning "revisionUnknownString" and/or some new customizable strings? I i think of an running app with some old, not resolveable revisions i would prefer a clean sting output like "Model not found" or "Relation not found"?

from revisionable.

duellsy avatar duellsy commented on July 25, 2024

Cool.

Basically, because it's catching behaviour that shouldn't happen, therefor exceptions to the norm. The only cases that it should occur is if someone has modified the records in their database manually, or have moved their models to a new namespace. If you were to move a class to a new namespace and not change your code, an Exception would be thrown too, so it's just kind of sticking to that mentality.
As well as providing an area in code to be able to handle differently later, for now it just logs the issue for you to see in your log files.

from revisionable.

mmodler avatar mmodler commented on July 25, 2024

Yes you're right - if i mess up the databse or rename my models i'll have to check my revisions table. And without exeptions i would propably never notice that there is something broken...

I will continue testing...

from revisionable.

Antonimo avatar Antonimo commented on July 25, 2024

I was declaring classnames anyway:

class Biz extends MyRevisionable {
protected $classname = 'Biz';

so you can use that:

'revisionable_type' => (isset($this->classname) ? $this->classname : get_class($this)),

about the case with old database: when changing the app, migrate the database (update the columns to have the new classnames with namespacing)

from revisionable.

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.