symfony 5.3 Restore a Softdeleteable - bundle

here is my concern:
I use the softdeletable installed with StofDoctrineExtensionsBundle,
I can delete easily, and I have created a recycle garbage can where I can see the deleted items,
However, I can't restore the soft delete items, is there a known method ? I can't find it

Undelete the entity by setting the deletedAt field to null
$entity->setDeletedAt(null);

Related

Is there a way how to recreate a field for a Dynamics CRM entity?

Our particular situation is that we have a DateOnly field and would like to change it to DateTime field supporting also the time portion. The operation is not allowed in UI and it's also stated in the documentation. Hence, I excepted deleting the field and recreating it with the new setting would work.
However when I try to create the field with the same name the Duplicate Field Name error is thrown. I've read the column actually still exists behind in the DB.
Of course, I could create a field with a new name but it would require changing all related workflows and code customizations.
Is there a way how to overcome this issue?
Deleting and recreating an attribute with the same name but different type should work - of course with the caveat that you have to remove all dependencies before deleting the attribute and recreate them with the new attribute.
The Duplicate Field Name error seems to indicate that the field still exists - perhaps the entity needs to be published after deleting.
You may also find the XrmToolbox tool Attribute Manager helpful.
It allows you to migrate an attribute and its data to a new attribute.

How to undelete a field in MSCRM entities

I am trying to add a field to my entity call abc_salespersonname when I try to add it I am presented with duplicate field name.
The field does not show in the solutions entity field list but I can see it in the database.
I do know that when you delete a field from an entity, it does not actually delete from the database.
So my question is, how can I bring this field in the database back onto the entity.
You cannot Undelete any field in a supported way. Once deleted is deleted, gone forever.
Not sure, if you are mixed up with “Remove” & “Delete” options within solution sub-components. Atleast “Publish All Customizations” will make all the database schema, Metadata & UI in sync. Verify the default solution by going to Settings->Customizations->Customize the system to double check.
If you are seeing duplicate field name alert, then you cannot bypass it. Create a new field with different name & move forward.

Symfony/Doctrine: "Soft update" if a certain field has changed

I know you can soft delete in Doctrine (i.e. do not delete a record but rather add a "deleted" value). There's an extension for that.
Now I wonder if there's a way to "soft update" a record. I mean not actually update the record but rather create a new record and make the old one invalid. In the same extension as soft-delete, there's a function loggable, but this one logs to a different table.
I could create a controller that, instead of updating, soft-deletes
(and thus invalidates) the old record, and then creates a new one
with the new values. But I'm unsure if this is a good practice.
Maybe I should create this action on the object itself? But I'm
unsure how to do this.
Edit
I've looked into Versionable and EntityAudit (as suggested by Tomas), but it seems these bundles do way too much. I merely want to check if a given field is different from the old one, and if not: soft-delete the old one (I'm using softDeleteable so a simple remove() will do); then create a new one with the changed values.
So ideally it would lurk in the shadows until an update is performed. Then read from the mapping configuration which fields it needs to watch, and if these fields are indeed different from what's persisted, the program should execute the remove() and persist() commands.
This extension might suit your use case:
simplethings/EntityAudit
It records any changes you want to track.
So it should be pretty easy to modify it to meed your needs.

How can I stop "Cascade Delete" from being silently removed by Entity Framework?

I have a cascade delete set in my database. I have also set a cascade delete for the corresponding relationship in my EDMX model.
However if I delete the tables with the relationship from the EDMX and then add them back in through "Update Model From Database" - the cascade has been removed.
Craig Stuntz in a related question suggests that it is a feature, however if my cascades are being silently removed each time I do an update of the model - that's unworkable.
Perhaps I need to change my workflow and not delete and re-add tables in the EDMX, rather just make all the little individual column changes by hand?
If you delete anything from your model you also delete all your changes. Your changes are gone and EDMX doesn't know about them any more. Once you add tables again you must do all your changes again as well.
If you want to keep your changes don't delete your entities and instead run wizard directly. It should just update existing entities without removing most of your changes. I'm aware only about single example where this doesn't work and your changes are lost and that relates to renaming some navigation properties.

How can I determine the "deleted on" date of an item in Exchange using EWS?

I've written a C# program using managed Exchange Web Services (EWS) to query a user mailbox in Exchange 2010.
We need to be able to look at the recoverable items for various users and see for each user how many items were deleted within a specific time range. I have been able to query the WellKnownFolderName.RecoverableItemsDeletions folder and fetch the items, but I can not find any property that tells when the items were deleted. (The Outlook GUI shows this date, so I know the property must be stored somewhere.)
There are no standard properties that look like "DateDeleted" or anything close. I have tried to see if the extended MAPI property PR_DELETED_ON is defined for the items, but either it is not or I'm not querying it correctly.
How can I find out when these items were deleted?
-mark
As you stated, supposedly an extended MAPI property named PR_DELETED_ON is set when an item gets deleted permanently from the Deleted Items folder, however, I've never run into this property myself either.
Instead, look at the value for the deleted item's PR_LAST_MODIFICATION_TIME property (0x30080040). This property stores a PT_SYSTIME value reflecting the date and time the item was last modified. This property is updated when an item is deleted, so you should be able to use it as an indicator as to when the item was deleted.
You stated you were using the RecoverableItemsDeletions enumeration value. This points to the Deletions subfolder underneath the inbox's Recoverable Items folder. This is where items go that are deleted from the Deleted Items folder. So, be aware that the value for the PR_LAST_MODIFICATION_TIME property of any item found in that folder will reflect the date and time that the item was deleted from the Deleted Items folder (unless the user soft-deleted it).

Resources