2709 search results for Doctrine

... 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!
weaverryan
weaverryan
Read Full Comment
... 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 ...
76 lines | src/Entity/Answer.php
// ... lines 1 - 2
namespace App\Entity;
use App\Repository\AnswerRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AnswerRepository::class)
*/
class Answer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text")
*/
private $content;
/**
* @ORM\Column(type="string", length=255)
*/
private $username;
/**
* @ORM\Column(type="integer")
*/
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
58 lines | src/Entity/Tag.php
// ... lines 1 - 2
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\TagRepository")
*/
class Tag
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=180)
*/
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 ...
Diaconescu
Diaconescu
Read Full Comment
... 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 ...
weaverryan
weaverryan
Read Full Comment
... ), 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 ...
weaverryan
weaverryan
Read Full Comment
... ; 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 ...

2:50
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 ...

3:08
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 ...

3:15
Sending Handlers to Different Transports from_transport

... MessageSubscriberInterface: it talks about what's available. Next, let's up our queueing game by changing from the Doctrine transport to RabbitMQ - also commonly referred to as AMQP. It's buckets of fun!

3:21
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!

3:18
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 ...

3:59
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 ...

3:46
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 ...

3:45
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 ...

3:29
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 ...

3:26
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 ...

3:30
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. ...

2:46