I have a little confusion regarding difference between ORM and PDO?
Is PDO a kind of ORM?
ORM as per my understanding is basically a kind of data mapping and PDO also provides an abstraction for the database data.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PDO and ORM are two entirely different things.
PDO is a specific implementation of a Database Access Abstraction Layer, it enables you to connect, run SQL and retrieve results from the database with an API that is consistent across different database backends (e.g. MySQL, PostgreSQL, MS SQL, etc.)
An ORM on the other hand is something more specialised: It’s a framework for mapping relational tables to application domain objects and relationships between them. These are often built on top of DALs like PDO.
To see the difference, consider having to retrieve an object or record. With PDO, you’d need to write SQL for selecting the right row in the right table, and have logic for extracting that row, and mapping the fields to a PHP object’s variables. You as the user have to take care of all this.
On the other hand, with an ORM, you’d simply say: find me the Object X by this ID, and the ORM would do its magic and give you that object, without you having to write the SQL yourself.