2724 search results for Doctrine

15 lines | src/Doctrine/DiscontinuedFilter.php
// ... lines 1 - 4
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\Filter\SQLFilter;
class DiscontinuedFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
// TODO: Implement addFilterConstraint() method.
}
}
See Code Block in Script
14 lines | src/Doctrine/UserSetIsMvpListener.php
// ... lines 1 - 2
namespace App\Doctrine;
// ... lines 4 - 6
class UserSetIsMvpListener
{
// ... lines 9 - 12
}
See Code Block in Script
// ... lines 1 - 2
namespace AppBundle\Doctrine;
// ... lines 4 - 7
class HashPasswordListener implements EventSubscriber
{
// ... lines 10 - 13
}
See Code Block in Script
<?php
namespace AppBundle\Doctrine;
class DiscontinuedFilter
{
}
See Code Block in Script
// ... lines 1 - 6
use Doctrine\ORM\Event\LifecycleEventArgs;
// ... lines 8 - 9
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 18
public function prePersist(LifecycleEventArgs $args)
{
// ... lines 21 - 30
}
// ... lines 32 - 36
}
See Code Block in Script
// ... lines 1 - 4
use Doctrine\Common\EventSubscriber;
// ... lines 6 - 7
class HashPasswordListener implements EventSubscriber
{
public function getSubscribedEvents()
{
// ... line 12
}
}
See Code Block in Script
// ... lines 1 - 6
use Doctrine\ORM\Event\LifecycleEventArgs;
// ... lines 8 - 9
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 28
public function preUpdate(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof User) {
return;
}
$this->encodePassword($entity);
// necessary to force the update to see the change
$em = $args->getEntityManager();
$meta = $em->getClassMetadata(get_class($entity));
$em->getUnitOfWork()->recomputeSingleEntityChangeSet($meta, $entity);
}
// ... lines 43 - 63
}
See Code Block in Script
14 lines | src/Doctrine/UserSetIsMvpListener.php
// ... lines 1 - 4
use App\Entity\User;
class UserSetIsMvpListener
{
public function postLoad(User $user)
{
$user->setIsMvp(strpos($user->getUsername(), 'cheese') !== false);
}
}
See Code Block in Script
14 lines | src/Doctrine/UserSetIsMvpListener.php
// ... lines 1 - 4
use App\Entity\User;
class UserSetIsMvpListener
{
public function postLoad(User $user)
{
// ... line 11
}
}
See Code Block in Script
// ... lines 1 - 7
class CheeseListingSetOwnerListener
{
// ... lines 10 - 16
public function prePersist(CheeseListing $cheeseListing)
{
if ($cheeseListing->getOwner()) {
return;
}
if ($this->security->getUser()) {
$cheeseListing->setOwner($this->security->getUser());
}
}
}
See Code Block in Script
// ... lines 1 - 16
public function prePersist(CheeseListing $cheeseListing)
{
if ($cheeseListing->getOwner()) {
// ... lines 20 - 22
if ($this->security->getUser()) {
$cheeseListing->setOwner($this->security->getUser());
}
}
// ... lines 27 - 28
See Code Block in Script
// ... lines 1 - 16
public function prePersist(CheeseListing $cheeseListing)
{
if ($cheeseListing->getOwner()) {
return;
}
// ... lines 22 - 25
}
// ... lines 27 - 28
See Code Block in Script
// ... lines 1 - 5
use Symfony\Component\Security\Core\Security;
// ... line 7
class CheeseListingSetOwnerListener
{
private $security;
// ... line 11
public function __construct(Security $security)
{
$this->security = $security;
}
// ... lines 16 - 26
}
See Code Block in Script
// ... lines 1 - 4
use App\Entity\CheeseListing;
class CheeseListingSetOwnerListener
{
public function prePersist(CheeseListing $cheeseListing)
{
}
}
See Code Block in Script
// ... lines 1 - 7
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 13
public function __construct(UserPasswordEncoderInterface $passwordEncoder)
{
// ... line 16
}
// ... lines 18 - 63
}
See Code Block in Script
// ... lines 1 - 7
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 13
public function __construct(UserPasswordEncoder $passwordEncoder)
{
// ... line 16
}
// ... lines 18 - 63
}
See Code Block in Script
// ... lines 1 - 7
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 13
public function __construct(UserPasswordEncoder $passwordEncoder)
{
// ... line 16
}
// ... lines 18 - 63
}
See Code Block in Script
// ... lines 1 - 9
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 18
public function prePersist(LifecycleEventArgs $args)
{
// ... lines 21 - 25
$this->encodePassword($entity);
}
// ... lines 28 - 48
/**
* @param User $entity
*/
private function encodePassword(User $entity)
{
if (!$entity->getPlainPassword()) {
return;
}
$encoded = $this->passwordEncoder->encodePassword(
$entity,
$entity->getPlainPassword()
);
$entity->setPassword($encoded);
}
}
See Code Block in Script
// ... lines 1 - 9
class HashPasswordListener implements EventSubscriber
{
// ... lines 12 - 18
public function prePersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof User) {
return;
}
$encoded = $this->passwordEncoder->encodePassword(
$entity,
$entity->getPlainPassword()
);
$entity->setPassword($encoded);
}
// ... lines 32 - 36
}
See Code Block in Script
// ... lines 1 - 7
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
class HashPasswordListener implements EventSubscriber
{
private $passwordEncoder;
public function __construct(UserPasswordEncoder $passwordEncoder)
{
$this->passwordEncoder = $passwordEncoder;
}
// ... lines 18 - 36
}
See Code Block in Script