1000 search results

Leveraging the Doctrine Data Provider

…argument. Instead, inject a collection data provider: CollectionDataProviderInterface and I'll call it $collectionDataProvider: You could also type-hint the specific Doctrine data provider class that we know we're going to inject - your call. Rename the argument and property... and then in getCollection(), return…

5:27
Źle używasz Doctrine'a ! (Tomasz Surowiec)

…zrozumienia ORM'a. Zbyt często widzę anemiczne encje z autoinkrementami, raporty generowane z kolekcji zhydrowanych obiektów i repozytoria przekaczające 2k wierszy. Bazując na doświadczeniu z wielu projektów, chciałbym pokazać czego unikać przy codziennej pracy z Doctrine'em, dlaczego to jest złe i jaka jest alternatywa.

35:40
The Patterns Behind Doctrine

…as much. For the Order, it's more important because order is a reserved word in most dbms. So that kind of messes up things. But when you work with Doctrine, um, so it's nice to, to give it an alternative name. As I…

37:39
More about Container, the “doctrine” Service and the Entity Manager

More about Container, the “doctrine” Service and the Entity Manager¶ In our test, we needed Doctrine’s entity manager and to get it, we used Symfony’s container. Remember from the first episode in this series that the “container” is basically just a big array…

1:54
Databases and Doctrine

… time as a datetime field; location as a string field; and details as a text field. These types here are configuration that tell Doctrine how each property should be stored in the database. If you messed anything up, panic! Or just exit with ctrl+c…

5:08
Symfony 3: Doctrine & the Database

…we'll get you rolling with Doctrine: learn how to use it, how to get hard work done easily and how to avoid the common pitfalls that can make Doctrine hard: Creating entity classes Managing migrations Saving new data Querying for data Custom repositories Custom…

12 videos
|
46:37
Auto Slug and Timestamps with Doctrine Extensions

…entity changes and createdAt: set to the current time when the entity is created. And there's a package that can do this DoctrineExtensions! In your terminal, run: composer require stof/doctrine-extensions-bundle This bundle has a recipe... but it isn't considered official…

3:34
Fetch the Object ID with Doctrine

…$object::class)); }: Next, $id = $om->getClassMetadata($object::class). This returns a special object that knows all about the Doctrine mapping for this class. ->getIdentifierValues() is what we want. Pass the $object instance: This retrieves the ID for the passed object, regardless of how it…

2:46
The "symfony console" Command & server_version

Doctrine is now configured to talk to our database, which lives inside a Docker container. That's thanks to the fact that the Symfony dev server exposes this DATABASE_URL environment variable, which points to the container. For me, the container is accessible on port…

3:55
Entity Class

Doctrine is an ORM: an object relational mapper. That's a fancy way of saying that, for each table in the database, we will have a corresponding class in PHP. And for each column on that table, there will be a property in that class…

7:57
make:docker:database

Doctrine is installed! Woo! Now we need to make sure a database is running - like MySQL or PostgreSQL - and then update the DATABASE_URL environment variable to point to it. So: you can absolutely start a database manually: you can download MySQL or PostgreSQL onto…

5:24
DoctrineBundle Updates & Recipe Upgrade

…you'll find that most of these are pretty minor. The most important changes are under "Services aliases". Previously, if you wanted to get the doctrine service, you could use the RegistryInterface type-hint for autowiring. Now you should use ManagerRegistry. Where do we use…

11:22
Upgrading to DoctrineBundle 2.0

…know. My hope is that a newer 3.something version will allow doctrine-bundle 2.0. But when we check on Composer... bah! It didn't work! But this time because of a different library: doctrine-migrations-bundle. That also needs to be updated. No…

6:50
The QueryBuilder

Doctrine speaks DQL, even though it converts it eventually to SQL. But actually, I don't write a lot of DQL. Instead, I use the QueryBuilder: an object that helps you build a DQL string. The QueryBuilder is one of my favorite parts of Doctrine

2:02
Creating an Entity Class

Doctrine is an ORM, or object relational mapper. A fancy term for a pretty cool idea. It means that each table in the database will have a corresponding class in our code. So if we want to create an article table, it means that we…

4:55
DoctrineExtensions: Sluggable

…it at the bottom. And actually, the only thing we need is under the orm.default key: add sluggable: true: This library adds several different magic behaviors to Doctrine, and sluggable - the automatic generation of a slug - is just one of them. And instead of…

4:59
Configuring DoctrineCacheBundle

…In the terminal, ls var/cache, then ls var/cache/dev: Hey! There's a doctrine directory with cache/file_system inside. There is our cached markdown. This bundle assumed that this is where we want to cache things. That was really convenient, but clearly…

3:26
Saving a Relationship

Doctrine will create a genus_id integer column for this property and a foreign key to genus. Use the "Code"->"Generate" menu to generate the getter and setter: Add a Genus type-hint to setGenus(): Yes, when we call setGenus(), we'll pass it…

3:18
Raw SQL Queries

…SQL! Open up FortuneCookieRepository. This is where we built a query that selected a sum, an average and the category name. The most important object in Doctrine is.... the entity manager! But that's just a puppet for the real guy in charge: the connection…

6:29
When Migrations Fail

My other favorite Doctrine Extension behavior is timestampable. Go back to the library's documentation and click to view the Timestampable docs. Oh, it's so nice: with this behavior, we can add $createdAt and $updatedAt fields to our entity, and they will be automatically…

5:34