->add('role', ChoiceType::class, [
'choices' => [
'Пользователь' => Role::ROLE_USER,
'Автор' => Role::ROLE_AUTHOR,
'Редактор' => Role::ROLE_EDITOR,
'Главред' => Role::ROLE_CHIEF_EDITOR,
'Администратор' => Role::ROLE_ADMIN,
],
'required' => false,
'placeholder' => 'Роль',
])
if (preg_match('#\b[^\s]+\b#ui', $content, $matches)) {
// Английские слова
} elseif (preg_match('#\b[^\s]+\b#i', $content, $matches)) {
// Русские слова
}
class TestRepository1
{
/**
* @var ObjectRepository
*/
private $repository;
/**
* @var EntityManagerInterface
*/
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->repository = $em->getRepository(Test::class);
$this->em = $em;
}
}
class TestRepository2
{
/**
* @var ObjectRepository
*/
private $repository;
/**
* @var EntityManagerInterface
*/
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->repository = $em->getRepository(Test::class);
$this->em = $em;
}
}
$pattern = '/my.key.*/';
$count = null;
foreach ($arr as $key => $value) {
if (!preg_match($pattern, $key, $match)) {
continue;
}
$count += 1;
}
echo $count;