... when Doctrine is working, but your listener is not actually needed. Good find ;). In Symfony 4.2, that config will be ON by default... because it's just THAT awesome :p.
Cheers!
... Hi Ryan
I've been following along and loving the series. You've got me using PHPStorm too which is awesome. Heading on to the doctrine tuts next and really looking forward to them.
I am also using WebPack Encore in a ...
|
// ... lines 1 - 2
|
|
namespace App\Entity; |
|
|
|
use App\Repository\AnswerRepository; |
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
|
|
|
class Answer |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
private $id; |
|
|
|
|
|
|
|
|
|
private $content; |
|
|
|
|
|
|
|
|
|
private $username; |
|
|
|
|
|
|
|
|
|
private $votes; |
|
|
|
public function getId(): ?int |
|
{ |
|
return $this->id; |
|
} |
|
|
|
public function getContent(): ?string |
|
{ |
|
return $this->content; |
|
} |
|
|
|
public function setContent(string $content): self |
|
{ |
|
$this->content = $content; |
|
|
|
return $this; |
|
} |
|
|
|
public function getUsername(): ?string |
|
{ |
|
return $this->username; |
|
} |
|
|
|
public function setUsername(string $username): self |
|
{ |
|
$this->username = $username; |
|
|
|
return $this; |
|
} |
|
|
|
public function getVotes(): ?int |
|
{ |
|
return $this->votes; |
|
} |
|
|
|
public function setVotes(int $votes): self |
|
{ |
|
$this->votes = $votes; |
|
|
|
return $this; |
|
} |
|
} |
See Code Block in Script
|
// ... lines 1 - 2
|
|
namespace App\Entity; |
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
|
|
|
class Tag |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
private $id; |
|
|
|
|
|
|
|
|
|
private $name; |
|
|
|
|
|
|
|
|
|
private $slug; |
|
|
|
public function getId() |
|
{ |
|
return $this->id; |
|
} |
|
|
|
public function getName(): ?string |
|
{ |
|
return $this->name; |
|
} |
|
|
|
public function setName(string $name): self |
|
{ |
|
$this->name = $name; |
|
|
|
return $this; |
|
} |
|
|
|
public function getSlug(): ?string |
|
{ |
|
return $this->slug; |
|
} |
|
|
|
public function setSlug(string $slug): self |
|
{ |
|
$this->slug = $slug; |
|
|
|
return $this; |
|
} |
|
} |
See Code Block in Script
I have Post model like this:
```
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Post ...
... code: https://github.com/api-platform/core/blob/d62e86e9cfa2a7a4eba3029053ff65f43a10e1ce/src/Bridge/Doctrine/Orm/ItemDataProvider.php#L75-L80
In most situations, where the `$id` you pass in is a string or int, the ...
... ), Doctrine has not queried for the Cart object *on that request*. Doctrine keeps track of all the objects it has saved or queried for during a request (so that if you query for the same object twice, it skips making a 2nd query ...
... ;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter ...
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.
...
2709
Doctrine
Filter Results