1000 search results

Profiling Command Line scripts

…flush() to, sort of, "clear" Doctrine's memory of the BigFootSighting object you just finished... so that it doesn't check it for changes when we call flush() during the next time through the loop: The point is: like with everything, make your code do…

6:33
Comparisons: Validate Performance Changes, Find Side Effects

…ll see this later - not every change we'll do in this tutorial will prove to be a good one. Next: Blackfire has a deep understanding of PHP, database queries, Redis calls and even libraries like Symfony, Doctrine, Magento, Composer, eZ platform, Wordpress and others…

3:56
Finding Issues via the Call Graph

…That's the last function before it jumps into Doctrine. So the problem in our code is something around this getUserActivityText() stuff. Let's open up this template: main/sighting_show.html.twig - at templates/main/sighting_show.html.twig. If you look at the…

6:50
Recommendations

…on your radar. There's also a recommendation that Doctrine annotation metadata should be cached in production. Honestly... I'm not sure why that's there - Symfony apps come with a config/packages/prod/doctrine.yaml file that takes care of caching these when you…

6:25
Mapping Messages to Classes in a Transport Serializer

…I did! I mean, handling messages asynchronously... that's pretty fun stuff. The great thing about Messenger is that it works brilliantly out of the box with a single message bus and the Doctrine transport. Or, you can go crazy: create multiple transports, send things…

4:56
Triaging a Bug Issue

…the user says that he got an error when trying to serialize a Doctrine QueryBuilder with the web profiler: something about not being able to serialize a PDO instance. The web profiler works by collecting a bunch of information about the request and serializing it…

8:36
Linking Symfony deps to your Local Copy

…to use annotations with the validator, you need to install the annotations library. Stop the web server and run: composer require annotations This installs sensio/framework-extra-bundle... we only technically need to install doctrine/annotations. But, that's ok. Restart the built-in web…

6:48
Flex Extras

…more going on. Find your composer.json file and make sure the version constraint is ^3.0. Then, run: composer update doctrine/doctrine-fixtures-bundle Version 3 of this bundle is all new... but not in a "broke everything" kind of way. Before, fixture classes…

6:31
Bye Bye AppBundle

…But, the fix is easy: Find all AppBundle and replace with App. Done! There is one last thing we need to undo: in config/packages/doctrine.yaml. Remove the AppBundle mapping we added. So, what other AppBundle things haven't been updated yet? It's…

7:51
Final config/ Migration

…We can also delete config_prod.yml. Oh, by the way, if you have some doctrine caching config in config_prod.yml, I would recommend not migrating it. The DoctrineBundle recipe gives you prod configuration that is great for production out-of-the-box. Booya…

7:25
Priming cache.app

…production. Add framework, cache and app set to cache.adapter.redis: cache.adapter.redis is the id of a service that Symfony automatically makes available. You can also use cache.adapter.filesystem - which is the default - doctrine, apcu, memcached or create your own service. If…

7:00
Safe Migrations

…back a deploy before. But, let's update it to be safe: SET image = poster, and then ALTER TABLE to drop poster: This is a safe migration. First, try it locally: ./bin/console doctrine:migrations:migrate Perfect! And now... deploy! Right? No! Stop that…

7:10
Autowiring Deprecations

…we can create an alias. Copy the Doctrine\ORM\EntityManager class name. Then, find your editor and open up services.yml. Add the alias: Doctrine\ORM\EntityManager aliased to @, and then copy the target service id: @doctrine.orm.default_entity_manager: We have full control…

5:36
Autowiring Controller Arguments

…container directly! We know the fix: type-hint a new argument with LoginFormAuthenticator $authenticator and use that below: Almost done! The app.doctrine.hash_password_listener service isn't being used anywhere, and neither is app.form.help_form_extension. And... that's it! At…

6:20
_defaults, autowire & autoconfigure

…it for you. This works for many - but not all tags. It does not work for doctrine.event_subscriber or form.type_extension: Because it has an extended_type tag option... which the system can't guess for you. When you're developing a feature…

5:20
Adding to a Collection: Cascade Persist

…operations for GenusScientist. Umm, what? Here's what's going on: when we persist the Genus, Doctrine sees the new GenusScientist on the genusScientists array... and notices that we have not called persist on it. This error basically says: Yo! You told me that you…

6:04
Collection Delete & allow_delete

…submit, the final array will have three GenusScientist objects in it, instead of four. Ready? Submit! Hmm, no error... but it still doesn't work. Why not? Hint: we already know the answer... and it relates to Doctrine's inverse relationships. Let's fix it.

4:49
Saving the Inverse Side of a ManyToMany

… What's going on!? This is the moment where someone who doesn't know what we're about to learn, starts to hate Doctrine relations. Earlier, we talked about how every relationship has two sides. You can start with a Genus and talk about the…

4:03
EntityType Checkboxes with ManyToMany

…to change the genusScientists property, that's what we should call the field. The type will be EntityType: This is your go-to field type whenever you're working on a field that is mapped as any of the Doctrine relations. We used it earlier…

5:39
Hooking up the Scientist Removal JavaScript

…Mixed in with AJAX call for notes is our DELETE call. Click the little sha, then go to the Doctrine tab. Ooh, look at this: DELETE FROM genus_scientist WHERE genus_id = 11 AND user_id = 11 Gosh darn it that's nice…

2:50