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>');
}
}
Рассмотрим случай когда пользователь вводит в форму номер документа и View передает этот номер Presenter'у. Если номер оказался неверного формата или не является уникальным, то может ли Presenter присвоить значение свойству RegNumber объекта Document?
A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time. Architectural Styles and the Design of Network-bas...
class RegNumber
{
private regNumber;
private construct(regNumber)
{
this.setRegNumber(regNumber);
}
private setRegNumber(regNumber)
{
this.assertRegNumberIsValid(
regNumber
);
this.regNumber = regNumber;
}
public static function create(regNumber)
{
return new self(regNumber);
}
private function assertRegNumberIsValid(regNumber)
{
if (regNumber is bad) {
throw new InvalidRegNumber()
}
}
}
{
"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