wiki/content/20201116134758-deprecate_public_services_into_private_services.md

27 lines
633 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: 6ecb0d08-16f6-42c5-ac0d-916b875bc1ff
title: Deprecate Public Services Into Private Services
---
# Description
Deprecated public services and turns them into private
# Syntax
``` yaml
services:
foo:
# ...
public: true
tags:
- { name: 'container.private', package: 'foo/bar', 'version': '1.2' }
```
If your application tries to get that service directly from the
container `($container->get('foo'))` you'll see the following error:
Since foo/bar 1.2: Accessing the "foo" service directly from the container
is deprecated, use dependency injection instead.