Skip to content

Tag: doctrine

Execute raw SQL using Doctrine 2

I want to execute raw SQL using Doctrine 2 I need to truncate the database tables and initialize tables with default test data. Answer I found out the answer is probably: A NativeQuery lets you execute native SQL, mapping the results according to your specifications. Such a specification that describes how an SQL result set is mapped to a Doctrine

Tracking the views of a given row

I have a site where the users can view quite a large number of posts. Every time this is done I run a query similar to UPDATE table SET views=views+1 WHERE id = ?. However, there are a number of disadvantages to this approach: There is no way of tracking when the pageviews occur – they are simply incremented. Updating