I have a Symfony2 application with a table that contains a date field, whose type is DateTime. I need to get all the entities where that field value is now. If I uses the following code, I get 0 results because Doctrine is comparing the DateTime object. I need to only compare year, month, and day, not hours. How can
Tag: symfony
How to get Doctrine to log queries in Symfony2
I’m pretty new to Symfony2, and I’m looking for a way to log SQL queries (including timings) to the same log file as the rest of my application. From what I can determine from the documentation this should all work out of the box, but after a few hours of trying I can’t figure out what I’m doing wrong. config_dev.yml
Symfony2 persist form collections with Doctrine UNIQUE INDEX and ORDER BY?
I have a User entity that has a collection of List Items associated with it. Each List Item entity also references another entity, Topic. I have setup a UNIQUE constraint on the List Item table that …
Twig get url parameter with []
I have an url like : MYURL?filter[_per_page]=25&filter[name][value]=hello How can i get these parameters with twig ? I’m trying {{ app.request.get(‘filter[_per_page]’) }} but it’s always empty… Thanks ! Edit : I’m in javascript an i want to assign this result to a javascript variable like : var param = “{{ app.request.get(‘filter[_per_page]’) }}”; Answer You must manage as an array accessing to
Difference between call flush() inside foreach loop or outside it, which one to use?
I’m having this doubt for a while but now is time to ask around it. See the code below and having a huge items in $someVar, for example 200 items: Both calls will do the same? meaning delete records from the DB? At performance level, which one is best to use? (Doctrine behaves as a memory killer sometimes) If both
Doctrine : Default value on joinColumn field
New to symfony2 and Doctrine. How can I set a default value to the field foo_id (which is a reference on Foo table) to point on the ID 1 of the Foo table (which exists in all cases) ? I tried a lot of things without success : Set default value to ID 1 in the constructor of Foo Perform
SwiftMailer silently ignores errors when messages fail delivery
When run from inside controller and when in-memory spooling is configured via spool: { type: memory } swiftmailer seems to work like this: whenever from within controller mailer->send($message) …
Symfony2: Warning: spl_object_hash() expects parameter 1 to be object, integer given
I have a many to one relationship between the entities Project and Course because each course can have many projects so many projects could be related to the same course. These are my entities: and The error appears when i try to insert a new project for my course, this is my form builder: I try to insert these data
Memory leak when executing Doctrine query in loop
I’m having trouble in locating the cause for a memory leak in my script. I have a simple repository method which increments a ‘count’ column in my entity by X amount: Problem is, if I call this in a loop the memory usage balloons on every iteration: What am I missing here? I’ve tried ->clear(), as per Doctrine’s advice on
Why I can’t get Symfony Finder like a service?
I use Symfony Standard Edition and try to get Symfony Finder component like a service, but not found it. To use the Finder, I need to create it manually like: Why I can’t get it from service container? Is it was wrong? P.S. The Symfony Filesystem component exists in service container and available by name filesystem. Answer The Symfony’s Finder