1000 search results

When Testing Makes No Sense

…you TDD everything? Yes. I was really interested because I found TDD to be very wrong for Symfony, the Symfony part, like using the Forms, using the Doctrine and stuff like that. And I was wondering, okay, how do you do that? Oh, we don…

36:55
Leverage the power of Symfony components within ApiPlatform

…composer require api is in fact, um, launching a Flex recipe that will install API Platform, but also the doctrine-bundle, CORS support - Cross Origin Resource Management - and everything you need to basically have an API started. So these three steps, and I'm done…

27:45
Registration Form

…console make:migration Let's go check out that new file. Yep! No surprises: it just makes the column not required. Move back over and run this with: php bin/console doctrine:migrations:migrate Excellent! Let's try to register! Register as geordi@theenterprise.org…

7:15
Fun with Commands

…if you needed your SlackClient service, you would just add a __construct() method and autowire it! With our new knowledge, let's keep going and start mastering features, like the Doctrine ORM, form system, API stuff and a lot more. Alright guys, seeya next time…

5:44
Services

…you learn to master services, you can do anything from anywhere in Symfony. There's a lot more to say about the topic of services, and so many other parts of Symfony: configuration, Doctrine & the database, forms, Security and APIs, to just name a few…

7:24
Exceptions Part 2: Adding Fence Security

…Actually, I don't need to refactor, but now is a great time to add the missing Doctrine annotations. Above the $securities property, add @ORM\OneToMany() with targetEntity="Security" and mappedBy="enclosure". enclosure is the name of the property on the other side of the…

7:11
Rock some FOSUserBundle!

…php bin/console It's alive! Now, we can generate the migration for our User class: php bin/console doctrine:migrations:diff Yep, that looks about right. Run it: php bin/console doctrine:migrations:migrate Perfect! At this point, the only thing this bundle has…

12:02
Give the User a Subscription (in our Database)

…and $stripeSubscription->id: Booya! And, time to save this to the database! Since we're using Doctrine in Symfony, we need the EntityManager object to do this. I'll use dependency injection: add an EntityManager argument to the __construct() method, and set it on a…

8:41
API Pagination Done Easily

…m just trying to keep things simple. If I were doing this in a real project, I'd probably use a library called Pagerfanta. It helps you paginate and has built-in adapters already for Doctrine, and Elastic Search. You can give it things like…

8:48
Twig Extensions and Dependency Injection Tags

…to unlocking really powerful features. A very important tag is kernel.event_listener, which allows you to register “hooks” inside Symfony at various stages of the request lifecycle. That topic is for another screencast, but we’ll cover a very similar subject next: Doctrine events.

4:33
Customizing the Contentful Slugger

…can run: symfony console doctrine:migrations:migrate current-1 That will reverse the most recent migration, causing the contentful and route tables to be dropped. Put them back with: symfony console doctrine:migrations:migrate Re-sync the content again: And now check the routes: Yes…

5:36
Content Browser: Returning the Items

…web debug toolbar, we have a 400 error. Dang. When we open that up, we see: Value loader for doctrine_recipe value type does not exist. There's just one final piece we need: A very simple class called the "value loader". That's next.

5:33
Entity objects in Twig

…most recent requests we've made. Here's the one we just made to /questions/new. Click the little token string on the right to jump into the full profiler for that request! Go to the "Doctrine" tab and... bam! Cool! It even wraps the…

4:55
Database Tricks on SymfonyCloud

…main php bin/console doctrine:fixtures:load Ok, let's break this down. First, there is actually a much easier way to do all of this... but I'll save that for some future SymfonyCloud tutorial. Basically, we're running the doctrine:fixtures:load command…

8:00
Timeline: Go Behind-the-Scenes with your Code

…not that there are only 3 objects being hydrated during this request, but that our code asks Doctrine to hydrate one or more objects on three occasions. So where are the 3 times that we're hydrating objects? One of the cool things is that…

7:15
Migrating framework Config

…Great! Delete the validation line! What's really interesting is that enable_annotations is set to true because it detected that we have the Doctrine annotations package installed. This is the flow with Flex: install a package and you're done. Ok! It might not…

7:45
ManyToMany with Extra Fields

…is still there, just the way it always was. If you try to run this migration...it will blow up, with this rude error: Incorrect table definition; there can be only one auto column... It turns out, Doctrine has a bug! Gasp! The horror! Yep…

8:20
Idempotency, changed_when & Facts

…and paste that below: So what language happens when there are no migrations to execute? Go to your virtual machine and run the migrations to find out: ./bin/console doctrine:migrations:migrate --no-interaction Yes! It says: No migrations to execute That's the key…

6:48
Blog
Doctrine's HIDDEN Gem

We had a great question from a user recently where the answer involved a little-known Doctrine feature called HIDDEN. You won't need it often, but it deserves its 5 in the spotlight! HIDDEN allows you to select a field so that you can…

By Leannapelham

Read Full Post
47 lines | config/packages/doctrine.yaml
doctrine:
// ... lines 2 - 7
orm:
// ... lines 9 - 18
filters:
fortuneCookie_discontinued: App\Doctrine\DiscontinuedFilter
// ... lines 21 - 47
See Code Block in Script