services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{Request,Entity,Migrations,Tests,Kernel.php}'
App\Console\:
resource: '../src/Console'
public: true
tags: ['console.command']
App\Command\:
resource: '../src/Command'
tags:
- { name: tactician.handler, typehints: true }
League\Tactician\CommandBus: '@tactician.commandbus'
class CreateCliRequest extends ContainerAwareCommand
{
/**
* @var CommandBus
*/
private $commandBus;
public function __construct(?string $name = null, CommandBus $commandBus)
{
parent::__construct($name);
$this->commandBus = $commandBus;
}
protected function configure()
{
$this
->setName('create:cli:req')
->addArgument('name', InputArgument::REQUIRED)
->setDescription('Some command');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$request = new CreateRequest(12, $input->getArgument('name'));
$result = $this->commandBus->handle($request);
$output
->writeln('<info>' .$result . '</info>');
}
}
{
"constatns" : {
"post" : {
"POST_CREATED" : 1,
"POST_DELETED": 2,
// .....
},
//...
}
}
if (constants.post.POST_CREATED == post.status ) {
//.. что то очень важное
}
естественно страница авторизованного личного кабинета не вывелась, вручную к адресу project.local/account дописал https:// - получилось https://project.local/account
server {
listen 80 default_server;
server_name YOURWEBSITE.com;
return 301 https://$server_name$request_uri;
}
// дальше обычный конфиг:
server {
listen 80;
server_name YOURWEBSITE.com;
// ....
}
BlogBundle\Entity\Blog:
type: entity
table: bb_blog
repositoryClass: BlogBundle\Entity\Repository\BlogRepository
fields:
name:
type: string
length: 100
nullable: false
status:
type: string
length: 10
nullable: false
manyToOne:
user:
targetEntity: BlogBundle\Entity\User
joinColumn:
name: user_id
referencedColumnName: id
oneToMany:
posts:
targetEntity: BlogBundle\Entity\Post
mappedBy: blog
orderBy: { 'createdAt': 'ASC' }
cascade:
- remove
class InviteController
{
public function acceptCompanyInviteAction(Invite $invite)
{
/** просто как пример */
$this->get('invite.manager')->acceptCompanyInvite($invite);
return new Response('acccepted');
}
class InviteManager
{
/** @var InviteRepository $repository */
private $repository;
/** @var EntityManagerInterface $entityManager */
private $entityManager;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
$this->repository = $entityManager->getRepository('AppBundle:Invite');
}
public function acceptCompanyInvite(Invite $invite)
{
/** ваша логика */
$this->entityManager->persiste($invite);
$this->entityManager->flush($invite);
return $invite;
}