Comments (11)
Hmm, a very valid issue, will have a look into it. Thanks.
from revisionable.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- identifiableName() doesnt work with model User HOT 1
- additional fields not beeing stored when Storing Creations HOT 2
- Supporting multiple auth HOT 1
- Nothing happens when I try to save instance from `Comment` model HOT 2
- Explicitly providing `user_id` to Revisionable HOT 1
- Revisionable not creating revision entries for belongsToMany relationships HOT 1
- Revisionable is largely abandonware – look elsewhere HOT 3
- More documentation around identifiableName() HOT 2
- so i created this fuction to return 'meta', anyone knows how to access [key] => date_achat / i want to display only the arrays where key == date_achat
- DateTime object to json serialization
- The article link in Readme.md is not working
- use in tables without integer primary key
- New Feature: Save changed and append custom data HOT 3
- Laravel 10 Support
- Is it a part instead of the whole? HOT 1
- Consider storing only attributes that have been changed and only the diff values HOT 1
- Please allow table name to be configurable HOT 2
- Invalid foreign key for SoftDelete returns unknown instead of the original id HOT 1
- Display revisions in Laravel Nova HOT 2
- Encrypted values not decrypting on read
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from revisionable.