Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COwhat if they decided to store images using Amazon S3, now you have database calls, and Rest calls in the same class. There should be a service with a method that wraps both calls. One to remove the record from the database, and then if that succeeds, a call to delete the file can be made, and that class can handle the details about if the image is on the file system, in the cloud, or in the database. I see those as two different responsibilities and two different concerns. They should be separated in implementation.
      singulars
    2. COSo, if my images are in the database then that's fine, it's a single concern but if the images are stored elsewhere then you plan to make the location of the images a separate concern to the location of the rest of the Product data and pass responsibility for knowing that to the application?
      singulars
    3. CONo, the application can still be ignorant to where the images are stored. I would use an IImageManager interface with a 'DeleteImage' method. The app would need to use a concrete implementation of that interface that I would give to the calling application using Dependency Injection. I see your point, that they are related actions, and I'm not saying your approach is 'wrong', I'm saying that I think there are more fault tolerant ways of accomplishing this. You could make database calls, and file operations in your controller methods too, but you aren't for a reason. Separation of concerns.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload