1000 search results

FOSUserBundle

…stored in the database. Let’s create a new bundle called UserBundle to house the new entity. Instead of using the doctrine:generate:bundle task, I’ll just create a UserBundle and make sure there’s a properly-named bundle class inside. Don’t forget…

13:15
Content Browser

…when we try the page, we're greeted with an error! Netgen Content Browser backend for doctrine_recipe value type does not exist. Yep! We need to implement a class that helps Layouts browse our recipes. That's called a "content browser". Adding a content…

9:02
Item View Template

…match one piece of config, like this template, with some other piece of config, like the doctrine_recipe value type. There are a finite number of these matchers, and we're going to see the most important ones along the way. So don't worry…

6:27
Value Converter

…s an instanceof Recipe: Second, for getValueType(), return the internal key of our value type: doctrine_recipe: Next is getId()... and we're literally going to return our ID with $object->getId(): We don't have autocomplete on this, but we know this object will…

8:50
Adding Lists: Value Type

…The same is true if you're using Ibexa CMS. So here's our next big goal: to add our Recipe Doctrine entity as a "value type" in layouts so that we can create lists and grids containing recipes. Step one to adding a value…

9:58
Enhanced Docker Integration & Testing Emails

…Finally, just like normal, thanks to our config/packages/doctrine.yaml configuration, the DATABASE_URL environment variable is used to talk to the database. So the Symfony binary plus Docker is a nice way to quickly and easily boot up external services like a database…

10:57
Recipe Upgrades with recipes:update

…the recipe relate to the config files, and I bet you can see what's happening. It deleted two environment-specific config files and updated the main one. Hmm. Open config/packages/doctrine.yaml. Sure enough, at the bottom, we see when@test and when…

6:13
Customizing the User Class

…roles and first_name columns. Close this... and run it: symfony console doctrine:migrations:migrate Success! And because the User entity is... just a normal Doctrine entity, we can also add dummy users to our database using the fixtures system. Open up src/DataFixtures/AppFixtures…

3:08
Verify Email after Registration

…migration: symfony console make:migration Go check that out and... awesome. It looks exactly like we expect: Run it! symfony console doctrine:migrations:migrate Beautiful! Let's do one more thing related to the database. Inside of src/Factory/UserFactory.php, to make life simpler…

7:57
Dynamic Roles

…paste, use abraca_user@example.com... and leave roles empty: Let's do it! At your terminal, run: symfony console doctrine:fixtures:load When that finishes... spin over and refresh. We got logged out! That's because, when the user was loaded from the session…

4:28
Giving Users Passwords

…sure everything looks good: And... it does! Close it... and run it: symfony console doctrine:migrations:migrate Perfect! Now that our users have a new password column in the database, let's populate that in our fixtures. Open up src/Factory/UserFactory.php and find…

5:26
make:user

…like HumanoidEntity. If the "thing" that logs into your site would be better called a Company or University or Machine, use that name here. Do you want to store user data in the database via Doctrine? For us: that's a definite yes... but it…

5:57
Update Query & Rich vs Anemic Models

…whenever we need to save something in Doctrine, we need the entity manager. Add another argument: EntityManagerInterface $entityManager. Then, below, replace the dd($question) with $entityManager->flush(). Done! Seriously! Doctrine is smart enough to realize that the Question object already exists in the database and…

7:58
Smarter Entity Methods

…Symfony binary can inject the environment variables. When this finishes, I like to double check the migration to make sure it doesn't contain any surprises. This looks perfect. Execute it with: symfony console doctrine:migrations:migrate Beautiful! But... this did break one little thing…

7:57
Migrate Password Hashing

…Got it! It's also kinda fun to see how this looks in the database. Find your terminal and run: php bin/console doctrine:query:sql 'SELECT email, password FROM user' Interesting: every hashed password starts with the same $2y thing. That's no accident…

9:46
Validation Auto-Mapping

…How the heck did that work? The system - validation auto-mapping - automatically adds sensible validation constraints based off of your Doctrine metadata. The Doctrine Column annotation has a nullable option and its default value is nullable=false: In other words, the title column is required in…

8:49
Spotting Heavy Object Instantiation

…to instantiate Doctrine's EntityManager object. I know, we don't often think about how much time or how much memory it takes to instantiate an object, but it can sometimes be a problem. The next function call is for the instantiation of Doctrine's…

6:06
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