protected $usersToClients = [];
public function onMessage(ConnectionInterface $from, $msg) {
$msg = json_decode($msg);
if (property_exists($msg, 'auth')) {
$usersToClients[$msg->auth] = $from;
} else {
if (isset($usersToClients[$msg->toUser])) {
$usersToClients[$msg->toUser]->send($msg->message);
}
}
}
<?php}
{?>
}?>
<?php }
{ ?>
} ?>
header('X-Accel-Redirect: ' . $file);
header('Content-Disposition: attachment; filename=' . basename($file));
header('X-SendFile: ' . $file);
header('Content-Disposition: attachment; filename=' . basename($file));
header('X-Accel-Redirect: ' . $file);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
exit;
header('X-SendFile: ' . realpath($file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
exit;
$article = $articleRepository->find(1); // SELECT * FROM Articles WHERE id=1
$comments = $article->getComments(); // здесь не происходит запросов к БД
foreach ($comments as $comment) { // SELECT * FROM Comments WHERE articleId=1
echo $comment->getText();
}
$comment = $commentRepository->find(1); // SELECT * FROM Comments WHERE id=1
$article = $comment->getArticle(); // здесь не происходит запросов к БД
echo $article->getId(); // здесь тоже не происходит запросов к БД, вернет articleId комментария
echo $article->getName(); // SELECT * FROM Articles WHERE id=10
class RegisterType extends AbstractType
{
public function getName()
{
return '';
}
}
$form = $this->get('form.factory')->createNamed('', new RegisterType(), $user);
$form = $this->createForm(new RegisterType(), $user);
$form = $this->get('form.factory')->createNamedBuilder('', 'form', $defaultData)
->add('name', 'text')
->add('email', 'email')
->getForm();
$result = [];
$file = file_get_contents('file.txt');
$rows = explode('\n', $file);
$titles = explode('\t', array_shift($rows));
foreach ($rows as $row) {
$cols = explode('\t', $row);
for ($i=0; $i<count($titles); $i++) {
if (isset($cols[$i])) {
$cols[$titles[$i]] = $cols[$i];
unset($cols[$i]);
}
}
$result[] = $cols;
}
$first_names = array_column($result, 'first_name');
print_r($first_names);
$this->em->isOpen();
до добавления новой сущности? Если false - то произошла ошибка где-то до этого.