Firebase on Symfony4 - php

I use Firebase on my Symfony application.So, I install kreait/firebase-bundle but I don't know which file I can configure this bundle on symfony4.
This configuration:
kreait_firebase:
connections:
main:
host:
secret:
references:
users:
Which file I can use this configuration??

in the documentation packagist you can configure your settup in :
config/packages/firebase.yaml
thanks :)

Related

Run Symfony 3 without cache when predis is down

In my symfony project i use the predis package to connect with redis;
In my config.yml :
doctrine_cache:
providers:
redis_cache:
predis:
host: 127.0.0.1
port: 6379
In my config_dev.yml :
doctrine_cache:
providers:
redis_cache:
type: array
This works fine,
However, when the redis server is down, my production doesnt work either.
Is there a way for me to go through redis, but when the connection fails just act like there is no caching, just like in dev?
Thanks in advance, let me know if i need to clarify my question more.

Symfony3 FOSElasticaBundle doc example not working

I am trying to set up FOSElasticaBundle.
Composer json entry:
"friendsofsymfony/elastica-bundle": "^3.2"
I was following official docs tutorial, but this line doesn't work:
$finder = $this->container->get('fos_elastica.finder.app.user');
error i get:
You have requested a non-existent service "fos_elastica.index.app.user".
Do you have any idea why ?
Things i checked:
AppKernel.php contains 'new FOS\ElasticaBundle\FOSElasticaBundle(),'
Profiler under 'Configuration' tab does not show 'FOSElastica' as enabled :(
config.yml:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
app:
types:
user:
mappings:
email: ~
persistence:
# the driver can be orm, mongodb, phpcr or propel
# listener and finder are not supported by
# propel and should be removed
driver: orm
model: AppBundle\Entity\User
provider: ~
listener: ~
finder: ~
Thanks in advance for any insights, guys :)
Turns out bundle didn't install properly.
"minimum-stability": "dev",
in composer.json on fresh installation worked

Configuring DoctrineExtensions-Taggable in Symfony fullstack with config.yml

I am having difficulty configuring the Doctrine Extension Taggable provided here:
https://github.com/FabienPennequin/DoctrineExtensions-Taggable
My project is using Symfony 2 Fullstack and my configuration is using yaml while my doctrine entities are using annotation. I installed DoctrineExtensions using composer. Adding "fpn/doctrine-extensions-taggable": "dev-master" to the require section on composer.json and then running composer update. This installed without issue.
I then become lost at this section: https://github.com/FabienPennequin/DoctrineExtensions-Taggable#setup-doctrine
I understand that the metadata is a Doctrine Entity however as previously mentioned I am using yaml for my symfony configuration as well as entity managers. Here is the excerpt from my config.yml file:
# Doctrine Configuration
doctrine:
dbal:
default_connection: default
connections:
default:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
orm:
default_entity_manager: main
auto_generate_proxy_classes: "%kernel.debug%"
entity_managers:
main:
connection: default
mappings:
VendorMainBundle:
prefix: Vendor\MainBundle\Entity
taggable:
connection: default
mappings:
taggable:
type: xml
prefix: DoctrineExtensions\Taggable\Entity
dir: %kernel.root_dir%/../vendor/fpn/doctrine-extensions-taggable/metadata
However, when I run php app/console doctrine:mapping:info --em=taggable I get the error:
[Exception]
You do not have any mapped Doctrine ORM entities according to the current configuration. If you have entities or mapping files you should check your mapping configuration for errors.
Should the above command show the mappings described in the xml files?
Thereby allowing me to update the schema in the database?
I used this documenation as reference for the config.yml file: http://symfony.com/doc/current/reference/configuration/doctrine.html#mapping-configuration
I also added this under the config.yml in order to setup the TagListener. Is this correct?
services:
taggable:
class: DoctrineExtensions\Taggable\TagListener
EDIT [#Grimv01k]:
The TagListener requires an argument passed that is an instance of the TagManager Object. I created another service to handle that as follows and passed it to the TagListener:
tag.manager:
class: DoctrineExtensions\Taggable\TagManager
tags:
- { name: doctrine.event_subscriber, connection: default }
arguments:
entity.manager: #doctrine.orm.entity_manager
taggable:
class: DoctrineExtensions\Taggable\TagListener
arguments:
manager: #tag.manager
The TagManager requires an argument of the entityManager however by doing so results in error:
[Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException]
Circular reference detected for service "doctrine.dbal.default_connection", path: "doctrine.dbal.default_connection".
Across the web it's recommended to resolve this error by passing #service_container and in the constructor of the object pull out the entity_manager, however being a vendor I'd prefer not to modify their code. Is there another way?
Just guess: maybe that happens becuse you haven't got tags applied in service, and Doctrine doesn't use this in your complier pass. Try to do it like this:
services:
taggable:
class: DoctrineExtensions\Taggable\TagListener
tags:
- { name: doctrine.event_subscriber, connection: default }

how to override host at Amazon S3 client?

im using symfony2 as framework form my application, i want to connect to my ceph client as it is said in API (same as amazon s3).
composer.json:
"knplabs/knp-gaufrette-bundle": "dev-master",
"aws/aws-sdk-php": "*",
"amazonwebservices/aws-sdk-for-php": "*"
im using gaufrette bundle to manage my filesystem
what i got so far is:
config.yml
mydrive.aws_s3.client:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
key: %my_drive_s3_key%
secret: %my_drive_s3_secret_key%
region: %my_drive_s3_region%
knp_gaufrette:
adapters:
my_drive_s3_v2:
aws_s3:
service_id: 'mydrive.aws_s3.client'
bucket_name: '%my_drive_s3_bucket_name%'
options:
create: true
directory: '%my_drive_s3_directory%'
filesystems:
user_fs:
adapter: my_drive_s3_v2
alias: my_drive_filesystem
stream_wrapper:
protocol: data
so following the api's this is the way i'm connecting to amazon s3 serwers
but im not using amazon s3 serwers im using my own ceph serwers.
and my question is how i change the host in amazon s3 client ?
now it's like this:
[curl] 56: Problem (2) in the Chunked-Encoded data [url] https://mybucket.s3.amazonaws.com
and i want this
https://mybucket.s3.amazonaws.com to be https://mybucket.s3.custom.com
here is the api i followed: https://github.com/KnpLabs/KnpGaufretteBundle#awss3
Try setting the base_url parameter.
config.yml
mydrive.aws_s3.client:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
key: %my_drive_s3_key%
secret: %my_drive_s3_secret_key%
region: %my_drive_s3_region%
base_url: https://mybucket.s3.custom.com
Please check the AWS SDK for PHP User Guide to see all of the client configuration options.

Error while configuring KnpGaufretteBundle

I am trying to configure KnpGaufretteBundle with the help of KnpLabs
But at the point of configuring Filesystems in config.yaml I got this error
ContextErrorException: Notice: Undefined variable: adapters in
C:\xampp\htdocs\symfony2\src\Knp\Bundle\GaufretteBundle\
DependencyInjection\KnpGaufretteExtension.php
line 50
I have tried a lot to solved it.
Can any know how to remove this error or how to configure KnpGaufretteBundle Bundle in symfony 2.3.5 ?
Any help would be appreciated.
You most likely forgot to add your adapters to the bundle configuration. That's why you end up with the exception when the extension tries to setup the filesystems here ($adapters is unedefined).
Please follow the documentation Configuring the Adapters
Thanks for reply,
in my config.yml i write below code
knp_gaufrette:
adapters:
foo:
local:
directory: /path/to/my/filesystem
app/config/config.yml
knp_gaufrette:
adapters:
# ...
filesystems:
bar:
adapter: foo
alias: foo_filesystem
Thanks you all, i have made following changes and its start working...
knp_gaufrette:
adapters:
foo:
local:
directory: /path/to/my/filesystem
create: true
app/config/config.yml
knp_gaufrette:
adapters:
foo:
safe_local:
directory: /path/to/my/filesystem
create: true

Categories