Goodbye SensioFrameworkExtraBundle
... /MixController.php. Down here, the route does have a {slug}
wildcard... but then a $mix argument, which is a Doctrine entity.
Behind the scenes, the param converter would automatically query for a
VinylMix where slug equals the {slug ...
Customizing the User Class
... 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 ...
5 Minutes Ago Strings
... not be converted to string
We know that when we have a datetime type in Doctrine, it's stored in PHP
as a DateTime object. That's nice because DateTime objects are easy to work
with... but we can't simply print them.
To ...
All about the User class
... class
is a Doctrine entity. Let's add another field to it, generate a migration & add
some dummy users to the database. Then, to authentication!
Partial Mocking
... 1 Dinosaur... but there should be 3! What's
going on? This is subtle: PhpUnit is smart enough to take this one dinosaur object
and return it each time growFromSpecification() is called. But to Doctrine, it
looks like ...
Aliases When Autowiring Fails
... Let's talk more about what happens when autowiring goes wrong. Right now, the
MarkdownTransformer class has two arguments, type-hinted with MarkdownParserInterface
and Cache from Doctrine:
But, these are not being ...
Fetching Items from a ManyToMany Collection
... users that appear in the
genus_scientist join table for this Genus.
Well, it turns out this query happens automagically, and the matching users are
set into the $genusScientists property. Yea, Doctrine just does it! All ...
Parameters The Variables of Configuration
... file
by saying %locale%.
Look under the doctrine key:
Hey, a bunch more, like %database_host% and %database_port%. These are set just
like locale, but in a different file: parameters.yml:
So that's it! If you add a new ...
Configuring DoctrineCacheBundle
...
being cached exactly?
Out of the box, the answer is in var/cache. 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 ...
Custom Query in EntityType
...
on this page. Here it is!
So, if you pass a query_builder option and set it to an anonymous function, Doctrine
will pass that the entity repository for this specific entity. All we need to do
is create whatever query ...
Process that Form
... that associative array to create a new Genus
object, populate it with the data, and save it via Doctrine.
But, it would be awesomesauce if the form framework could do our job for us. I mean,
use the data to automatically create the Genus object, populate it, and return
that to us. Let's do that.
...
Database Migrations
...
Integrity constraint violation: 1048 Column fun_fact cannot be null
Here's the deal: Doctrine configures all columns to be required in the database
by default. If you do want a column to be "nullable", find the column and ...
Stripe Customers Our Users
... we need to actually add the new column to our table.
Since this project uses Doctrine migrations, open a new tab and run:
All that did was create a new file that contains the raw SQL needed to add this
new ...
HATEOAS Loves Routers
...
it doesn't! I messed up some syntax. Anytime you see the Doctrine\Common\Annotations
T_CLOSE_PARENTHESIS type of thing, this is a syntax error in your annotation.
I'm missing a comma between my arguments. Let's try that ...
Welcome to Symfony
...
In this course, we've got some big goals:
Start a new project using Symfony2.
Explore the core areas, like routing, controllers, requests, responses and
templating.
Get comfortable with a few extra tools, like Doctrine ...
Dependency Inject All the Things
... constructor argument and a second class property:
// src/Yoda/EventBundle/Reporting/EventReportManager.php
// ...
use Doctrine\ORM\EntityManager;
use Symfony\Component\Routing\Router;
class EventReportManager
{
}
This time ...
Configuration Loading and Type-Hinting
... /Reporting/EventReportManager.php
// ...
use Doctrine\ORM\EntityManager;
class EventReportManager
{
}
If you’re not too comfortable with this, don’t worry. This is optional, but
a good practice to get into.
More with ManyToMany Avoiding Duplicates
... an attendee to the Event. And when Doctrine saves,
it tries to add a second row to the join table. Not cool!
Adding the hasAttendee Method¶
To fix this, create a new method in Event called hasAttendee. This
will return ...
Composer
...
I searched for the doctrine/dbal package and added it.
With the require command, you can search for the package you need and Composer
will automatically update your composer.json for you and run the update
command to ...
2725
Doctrine
Filter Results