Duplicate a Mysql Database – Tutorial

Learn how to duplicate a mysql database in 2 simple steps. Many a times, you want to duplicate a database to create a backup, to test against real data or just because you want to. Lets quickly checkout how this can be done step-wise. We will be using the command line utility to duplicate the database. Duplicate a Mysql database – Assumptions Lets assume that the database you wish to …read more

Configure Doctrine Multiple target entities

Many developers are often plagued with questions of the best possible way to handle inheritance mapping or configuring multiple target entities in doctrine. How does one do that? Lets go over a slightly different scenario first to understand the real problem better. Lets say you have 2 entities with their respective fields: Person (id, name, profession) Engineer (id, level) We want that Person could have a profession of an Engineer. …read more

Get Random rows in Doctrine

Every Php Symfony developer knows the struggle of getting random rows/records via Doctrine. This is because there is no native solution present and quite unfortunately, the doctrine team isn’t even willing to implement this feature! (Reference) So how could we get random rows/objects? Lets go over the possible options, each having its advantages & disadvantages : 1. Add a customized Numeric Function: To do this, define a new class in …read more