Comments (13)
+1
from entityauditbundle.
I've been thinking about metadata storage, that would allow storing of tags too, but please provide a code sample on how you imagine that.
from entityauditbundle.
What for code sample do you mean? Something like a scenario how to use use this feature?
We'd like to 'mark' an order to a certain tag
- when it was paid by a customer,
- when the order was completed
It also would be nice if this could work in combination with Symfony's built-in ACL, so something like a PRE_FLUSH
Doctrine listener that can make use of those tags/metadata.
from entityauditbundle.
I was discussing something like that with my colleague before, but we couldn't find a solutions other than
$entity = $repos->find();
$entity->setValue('new value');
$auditManager->attachRevisionmetadata($entity, array('source' => 'xml'));
$em->flush();
which is a very generic way actually. Do you have a better idea?
from entityauditbundle.
Don't exactly understand what you're trying to archieve with the code sample you gave. I would expect the $auditManager
to have a function like addTag($auditableEntity, $tagName=null)
with $tagName
as an optional parameter.
If I'm right this could be implemented by adding an extra column to the central revisions table, and adding a function to the manager to getEntityByTag($auditableEntity)
.
The built-in Bundle views could show the tags in an extra column.
from entityauditbundle.
Ah, you mean tagging existing revisions after these revisions are saved? I'm talking about attaching arbitrary metadata to entities before flash, which is a more generic way. Which approach suits you most?
from entityauditbundle.
Adding metadata (like a tag/name) to the current Unit-of-Work indeed does sound better, as long as the metadata will be unique and it will be possible to get an entity based on a metadata key.
from entityauditbundle.
Uh-huh. We'll try to mix up something next week.
How do you think is better - adding metas to current revision or per-entity?
from entityauditbundle.
You mean the target table for the metadata? I would add it to the revisions table, since it is possible for Doctrine to search in Array types. Tried to find documentation about it, but couldn't find it that fast.
from entityauditbundle.
I'm thinking about what is better - having a metadata bag for a revision or having an option to add metas to concrete entity.
Array is not much an option - I started hacking EntityAudit since we have to upgrade old project where history audit tables ar ~5m records long (it's a CMS with ~ 5000 pages and ~ 5 years of work).
from entityauditbundle.
Well, it looks like we need to have something like:
- AuditManager->addRevisionMeta($key, $value)
- AuditManager->addEntityMeta(object $entity, $key, $value)
that is persisted in OnFlush and also the following methods:
- Revision->getRevisionMeta
- ChangedEntity->getRevisionMeta
- AuditReader->findRevisionByMeta($key, $value);
@DavidBadura , what do you think?
from entityauditbundle.
great idea!
from entityauditbundle.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from entityauditbundle.
Related Issues (20)
- What happened to this project? It is transfer to `sonata-project`. HOT 4
- Audit tables are being generated for all entities, not just the ones specified in config HOT 3
- Support Annotations HOT 4
- Compare Revision (`CompareAction`) route not working HOT 11
- Identical Dates should not create a revision HOT 2
- Integration with EasyAdminBundle ? HOT 5
- Argument 3 passed to SimpleThings\EntityAudit\Revision::__construct() must be of the type string, null given HOT 3
- The "security.token_storage" service or alias has been removed or inlined when the container was compiled. HOT 1
- Extending revision entity/table. HOT 1
- Auditing an entity which uses foreign key as primary key fails HOT 2
- Ignore fields option not working HOT 8
- Support for translatable entities HOT 1
- Many To Many audit relation fail with new entity in the relation. HOT 9
- View changes not showing HOT 1
- Support for `doctrine/collections` ^2.0 HOT 1
- Incompatible with Lazy-Loading Proxies (Ghost)? HOT 10
- Doctrine ORM 3 support HOT 2
- Ignore related tables for auditiong HOT 2
- Multiple many-to-many relationships to same table causes DUPLICATE KEY error.
- spl_object_id() expects parameter 1 to be object, string given in PHP 7.4 and version AuditBundle 1.12 HOT 2
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 entityauditbundle.