// Set cell A8 with a numeric value, but tell PhpSpreadsheet it should be treated as a string
$spreadsheet->getActiveSheet()->setCellValueExplicit(
'A8', // координаты ячейки
"01513789642", // нужное значение строки
\PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING
);
//src/Events/GlobalSubscriber.php
namespace App\Events;
use App\Entity\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class GlobalSubscriber implements EventSubscriberInterface
{
/** @var RouterInterface $router */
private $router;
/** @var TokenStorageInterface $tokenStorage */
private $tokenStorage;
/**
* @param RouterInterface $router
* @param TokenStorageInterface $tokenStorage
*/
public function __construct(RouterInterface $router, TokenStorageInterface $tokenStorage)
{
$this->router = $router;
$this->tokenStorage = $tokenStorage;
}
public function onKernelRequest(RequestEvent $event)
{
if(!$event->isMasterRequest())
return;
$this->isUserBlocked($event);
}
/**
* Проверка блокировки пользователя
* @param RequestEvent $event
*/
private function isUserBlocked(RequestEvent $event)
{
if (empty($this->tokenStorage->getToken()) || !$this->tokenStorage->getToken()->getUser() instanceof User) return;
/** @var User $user */
$user = $this->tokenStorage->getToken()->getUser();
if ($user->isBlocked()) {
$event->setResponse(new RedirectResponse($this->router->generate('app_logout')));
}
}
public static function getSubscribedEvents()
{
return [
// Правка от @Flying
KernelEvents::REQUEST => 'onKernelRequest'
// Старый вариант - RequestEvent::class => 'onKernelRequest'
];
}
}
<div id="app">
<v-text-field
v-model="myModel"
label="Tine:"
@keyup="filterToFloat($event)"
@change.native="setToFloat($event)"
>
<span slot="append">час</span>
</v-text-field>
</div>
<script>
let app = new Vue({
el: '#app',
data: {
item: {
subitem: 0.25
}
},
methods: {
setToFloat: (event) => {
event.target.value = parseFloat(event.target.value)
event.target.dispatchEvent(new Event('input'))
},
filterToFloat: (event) => {
event.target.value = event.target.value.replace(',', '.').replace(new RegExp(/[^0-9.]/), '')
event.target.dispatchEvent(new Event('input'))
},
},
})
</script>
findNextFocus: function(event) {
let element = event.target;
['td', 'tr'].some(function(item, i) {
let nextElement = element.closest(item).nextElementSibling;
if(nextElement && nextElement.querySelector('.find-me-for-next-focus')) {
nextElement.querySelector('.find-me-for-next-focus').focus();
return true;
}
});
},
//src/Entity/User.php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Security\Core\User\EquatableInterface;
/**
* @ORM\Table(name="user", uniqueConstraints={@ORM\UniqueConstraint(name="UNIQ_8D93D649E7927C74", columns={"email"})})
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
* @ORM\HasLifecycleCallbacks()
*/
class User implements UserInterface, EquatableInterface
{
/**
* @see EquatableInterface
* @param UserInterface $user
* @return bool
*/
public function isEqualTo(UserInterface $user): bool
{
return $user->roles === $this->roles;
}
}