1000 search results

Joining Across a ManyToMany

…Behind the scenes, to get this data, Doctrine will need to query across the join table and the tag table. But... we don't really care about that! We just get to say question.tags and that returns all the Tag objects for this Question…

5:22
Upgrading KnpPaginatorBundle & PHP Platform Version

…TreeBuilder::root() thing. This is a low-level function that third-party bundles use. And if you dig through the list, this stof_doctrine_extensions comes from StofDoctrineExtensionsBundle... as does most of the other ones - like orm, and mongodb. The last one comes from KnpPaginatorBundle…

7:18
Attachments with Async Messenger Emails

…are a bunch of deprecation notices, but the tests do pass. However, run that Doctrine query again to see the queue: Uh oh... the email - the one from our functional test to the registration page - was added to the queue! Why is that a problem…

3:57
Final Upgrades & Cleanups

…s possible that some recipes have new versions we can update to. Run: composer recipes:update Oh, whoops! I need to commit my changes: git commit -m 'upgrading doctrine/dbal from 2 to 3' Perfect! Now run composer recipes:update and... cool! There are two…

6:33
Hunting the Final Deprecations

…Ctrl+C to exit the "tail" mode and run this again, but this time "pipe" it to grep Deprecated: We're now watching the log file for any lines that contain Deprecated. Unfortunately, because of that annoying doctrine/persistence stuff, it does contain extra noise…

5:06
Pagination

…way long. Not only will this page become hard to use, it will quickly slow down until it stops working. If you ever need to query and render more than 100 Doctrine entities, you're going to have slow loading times. If you try to…

9:19
Hello Flex: Moving Final Files

…console doctrine:migrations:status Ah! I guess not! It says that my migration class wasn't found: Is it placed in a DoctrineMigrations namespace? Bah! I don't know! Our files have an Application\Migrations namespace. What's going on? Open the config/packages/doctrine

4:00
Integration Tests

…if you mock everything... there's nothing really left to test For example, how would you test that a complex query in a Doctrine repository works? If you mock the database connection then... I guess you could test that the query string you wrote looks…

9:18
Database Setup

…Then cheat and copy the previous task. This is simple enough: run doctrine:migrations:migrate with --no-interaction, so that it won't interactively ask us to confirm before running the migrations. Interactive prompts are no fun for an automated deploy: Register another variable - run…

6:21
Collection Filtering: The Easy Way

…that my User correctly has a studiedGenuses property with a mappedBy option... But on GenusScientist, I forgot to add the inversedBy() that points back to this: I don't really know why Doctrine requires this... since it didn't seem to break anything, but hey…

6:05
Caching in the prod Environment Only

…the dev environment only? Yes! Copy the doctrine_cache from config.yml and paste it into config_dev.yml. Next, change type from file_system to array: The array type is basically a "fake" cache: it won't ever store anything. Yea, that's it…

3:16
OneToMany: Inverse Side of the Relation

…can think about any relationship in two directions: each GenusNote has one Genus. Or, each Genus has many GenusNote. And in Doctrine, you can map just one side of a relationship, or both. Let me show you. Open Genus and add a new $notes property…

5:08
Creating an Entity Class

…need a use statement for it. This will look weird, but add a use for a Column class and let it auto-complete from Doctrine\ORM\Mapping. Remove the Column part and add as ORM: Every entity class will have that same use statement. Next…

5:29
Custom Queries

…and-seek down in the web debug toolbar. Ah, it turns out this is an EntityRepository object - something from the core of Doctrine. And this class has the helpful methods on it - like findAll() and findOneBy(). Ok, wouldn't it be sweet if we could…

6:16
Filters

…put anything in DiscontinuedFilter yet, but most of the work is done. That ClassMetadata argument is your best friend: this is the Doctrine object that knows everything about the entity we're querying for. You can read your annotation mapping config, get details on associations…

10:29
Introduction

…the hood. We’ll learn what a service is, find out more about the core Symfony services and create a few of our own. In Doctrine, we’ll create some ManyToOne and ManyToMany relationships. We’ll also talk about lifecycle callbacks and event listeners. And…

1:00
Contentful: Loading Data from an External CMS

…what we're doing, it's a pretty quick process and would give us a lot of power on our site. But one of the beautiful things about Layouts is that our value types can come from anywhere: a Doctrine Entity, data on an external…

8:02
Data Persister Decoration

…object and validates it, it tries to save or persist that object. Usually, this means that we're saving an entity object to the database via Doctrine. But we could "save" an object anywhere, like by sending the data to another API, or putting it…

6:48
Decorating Data Persisters vs Context Builders

…called just DataPersister. Back in PhpStorm, hit Shift+Shift, search for DataPersister and make sure to include "non-project items". Select the one from ApiPlatform's Doctrine Bridge. And... cool! This looks pretty much exactly like we expected: it persists and flushes. This is what…

8:54
Publish State Change Validator Logic

… Or true to false? Or maybe it's not changing at all because the PUT request is only updating other fields. And hey! We already know how to get the original data from Doctrine! We did it in CheeseListingDataPersister: Oh, and by the way: if…

8:26