soft-delete

Soft Delete Nhibernate

我是研究僧i 提交于 2019-12-04 12:02:24
I want to make a soft delete on my db table...i have apply following statement (as described here http://nhibernate.info/blog/2008/09/06/soft-deletes.html and in a lot of question on SO). Fattura is my table where i want apply logical delete (there is no trigger on it) Fattura.hbm.xml <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Paggentola.Gestionale.DL.Model" namespace="Paggentola.Gestionale.DL.Model"> <class name="Fattura" table="Fattura" where="Cancellato=0"> <id name="Id_Fattura" column="Id_Fattura"> <generator class="native" /> <

How to disable soft delete (Soft-deleteable) filter for doctrine in symfony

匆匆过客 提交于 2019-12-04 01:14:34
Installing and using SoftDeleteable behavior extension for Doctrine 2 is quite easy. The problem usually is trying to disable it for some code part and enabling again. You may want to do this to: load entity that is soft-deleted remove entity from database entirely bypassing soft-delete filter So how to disable it? Aurelijus Rozenas 1. How to load soft-deleted entity As per the documentation, disable filter for entity manager: $em->getFilters()->disable('softdeleteable'); $object = $em->find('AppBundle:Object', 1); // soft-deleted entity will be loaded To enable soft-delete again: $em-

Cascading Soft Delete

一曲冷凌霜 提交于 2019-12-04 00:36:37
SQL has always had a great feature: cascading deletes. You plan it in advance and when it's time to delete something, BAM! No need to worry about all those dependent records. However, nowadays it's almost taboo to actually DELETE anything. You flag it as deleted and stop showing it. Unfortunately, I haven't been able to find a solid solution to doing this when there are dependent records. I've always manually coded the complicated web of soft deletes. Is there a better solution out there that I have completely missed? I hate to say it but triggers are designed specifically for this kind of

Why soft deleted entities appear in query results?

拈花ヽ惹草 提交于 2019-12-03 15:43:59
问题 I am trying to implement soft deleting concept. Here is my object: class Post extends Eloquent { /** * The database table used by the model. * * @var string */ protected $table = 'posts'; protected $softDelete = true; ... Soft delete is on. Now, if I 'delete' a post, it gets a 'deleted_at' timestamp: The problem is, when I search or just use all() to display the posts, the soft deleted items appears there. What is wrong? 回答1: The soft deleting feature works when using Eloquent. If you are

Why soft deleted entities appear in query results?

北城余情 提交于 2019-12-03 04:20:49
I am trying to implement soft deleting concept. Here is my object: class Post extends Eloquent { /** * The database table used by the model. * * @var string */ protected $table = 'posts'; protected $softDelete = true; ... Soft delete is on. Now, if I 'delete' a post, it gets a 'deleted_at' timestamp: The problem is, when I search or just use all() to display the posts, the soft deleted items appears there. What is wrong? Rubens Mariuzzo The soft deleting feature works when using Eloquent. If you are querying the results with query builder you will eventually see all the records trashed and not

Soft Delete vs. DB Archive

佐手、 提交于 2019-12-03 04:05:24
Suggested Reading Similar: Are soft deletes a good idea? Good Article: http://weblogs.asp.net/fbouma/archive/2009/02/19/soft-deletes-are-bad-m-kay.aspx How I ended up here I strongly belive that when making software, anything done up front to minimize work later on pays off in truck loads. As such, I am trying to make sure when approaching my database schema and maintenance that it can maintain relational integrity while not being archaic or overly complex. This resulted in a sort of shudder when looking at the typical delete approach, CASCADE. Yikes, a little over the top for my current

Filter all navigation properties before they are loaded (lazy or eager) into memory

≡放荡痞女 提交于 2019-12-03 02:31:07
问题 For future visitors: for EF6 you are probably better off using filters, for example via this project: https://github.com/jbogard/EntityFramework.Filters In the application we're building we apply the "soft delete" pattern where every class has a 'Deleted' bool. In practice, every class simply inherits from this base class: public abstract class Entity { public virtual int Id { get; set; } public virtual bool Deleted { get; set; } } To give a brief example, suppose I have the classes GymMember

Filter all navigation properties before they are loaded (lazy or eager) into memory

耗尽温柔 提交于 2019-12-02 16:23:44
For future visitors: for EF6 you are probably better off using filters, for example via this project: https://github.com/jbogard/EntityFramework.Filters In the application we're building we apply the "soft delete" pattern where every class has a 'Deleted' bool. In practice, every class simply inherits from this base class: public abstract class Entity { public virtual int Id { get; set; } public virtual bool Deleted { get; set; } } To give a brief example, suppose I have the classes GymMember and Workout : public class GymMember: Entity { public string Name { get; set; } public virtual

Entity Framework Code First Soft Delete Lazy Loading

匆匆过客 提交于 2019-12-02 12:57:42
问题 So I'm using Entity Framework Code First (so no .edmx) I have a base entity class with a bool IsEnabled to do soft delete's I am using repository pattern so all queries against the repository can be filtered out with IsEnabled. However any time I use the repository to get an MyType which is IsEnabled, Lazy Loading MyType.Items may mean that Items could be not enabled. Is there a way, perhaps with EF Fluent to describe how to do filtering on tables? Update: If I have a Dbset public class

Neo4j: implementing soft delete with optional relationships

℡╲_俬逩灬. 提交于 2019-12-02 08:36:35
问题 I'm trying to implement a soft delete in Neo4j. The graph described in Cypher from Alice's viewpoint is as such: (clyde:User)<-[:FOLLOWS]-(alice:User)-[:LIKES]->(bob:User) Instead of actually deleting a node and its relationships, I'm changing its label so it can no longer be looked up directly, i.e. dropping its User label and adding a _User label (notice the underscore) replacing its relationships so it can't be reached anymore by my normal queries, e.g. deleting its :FOLLOWS relationships