vendredi 23 octobre 2020

Best way to save objects in database

The Story: I’m trying to develop a big application in PHP. The main problem is that I have to deal with the objects and I need to apply CRUD operations. Ex: Suppose we have class diagram (Compiler):

Project { name:string, statements:list …}
Statement{ type:string }
IfStatement exend Statement { condition:Exp, …}
…

The question (What is the best design for ERD or database) as I know I’ve two solutions:

  1. Serialize the main object and save it in the DB
  2. Make a table for each class in the class diagram and linking by foreign keys I’ve read about ORM but I think it’s similar to 1st solution

Aucun commentaire:

Enregistrer un commentaire