Sonata Media Bundle - INVALID MODE - php

I am using Sonata Admin Bundle and Sonata Media Bundle. I use those versions. Symfony Version is 4.4.3
sonata-project/admin-bundle 3.58.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.18.3 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 Cache library
sonata-project/core-bundle 3.17.2 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle 2.5.0 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.5.1 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.13.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 2.0.1 Lightweight Exporter library
sonata-project/media-bundle 3.23.0 Symfony SonataMediaBundle
Furthermore I use the GalleryAdmin provided by the Media Bundle without any changes. In the Gallery Edit case I get following error:
INVALID MODE : s5e37f8b81382b_galleryHasMedias - type : CollectionType - mapping :
This error message is printed where the upload / edit forms of the Gallery Media Items should be:
There are few other people having the same error but i haven't found a working solution to it. Does someone know how to get rid of this error?

I've found this for you.
Maybe this could help, it looks like the error is comming from the ORM. You have to run app/console doctrine:cache:clear-metadata and then re-running doctrine:schema:update --force
source : INVALID MODE : s5a869f19a6c57_equivalents - type : sonata_type_collection - mapping :

Related

Doctrine getRepository call cannot find class following composer update

I have run a composer update on my Symfony 4.4 project and ran into an issue that will run throughout my project.
The following line:
$this->stadiumEntity = $this->getDoctrine()->getRepository('AppBundle:Stadium')
errors with:
Class AppBundle:Stadium does not exist
When I change it to the following it works, however there is clear some BC break in either Symfony itself or more likely one of the Doctrine packages. I just can't determine which one.
$this->stadiumEntity = $this->getDoctrine()->getRepository(Stadium::class)
I thought the issue was in doctrine/persistence, however the getRepository method hasn't really changed in 3 years.
composer show | grep doctrine
doctrine/annotations 1.13.2 Docblock Annotations Parser
doctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers...
doctrine/collections 1.6.8 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common 3.3.0 PHP Doctrine Common project is a library that provides additional functionality that other Doctri...
doctrine/data-fixtures 1.5.3 Data Fixtures for all Doctrine Object Managers
doctrine/dbal 2.13.9 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspecti...
doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable...
doctrine/doctrine-bundle 2.6.3 Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle 3.4.2 Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 3.0.3 Symfony DoctrineMigrationsBundle
doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be used with the variou...
doctrine/inflector 2.0.4 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to up...
doctrine/instantiator 1.4.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer 1.2.3 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations 3.4.2 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction...
doctrine/orm 2.12.2 Object-Relational-Mapper for PHP
doctrine/persistence 3.0.2 The Doctrine Persistence project is a set of shared interfaces and functionality that the differe...
doctrine/sql-formatter 1.1.2 a PHP SQL highlighting library

FOSElasticaBundle for symfony 3?

I'm looking to integrate the FOSElasticaBundle into my symfony 3 project. Currently this bundle doesn't support symfony 3. I was ondering what I could do to still implement it?
Seems is not yet tagged a valid release for using it via packagist. See this issue on github.
The release dev-master / 3.2.x-dev seems already compliant with symfony3.
I successfully installed this bundle on a symfony3 installation with the command :
composer require friendsofsymfony/elastica-bundle dev-master
Hope this help

Issues with Sonata Admin template?

I am installing Symfony 2.3.x and sonata admin bundle, but when it is installed, the admin panel is shown in a wrong way (see the screen capture).
This problem has appeared when I run composer update command. Before that, my sonata admin panel looks nice.
Any idea? Could be a problem with any template of sonata? (Icons from sonata not appear).
Thank you!
It appears that there is a dependency between the dev-master versions of SonataCoreBundle and SonataAdminBundle that breaks if any older version is used between either. Here is a GitHub issue regarding the problem
The solution is to use the ~2.3 Composer version tag of SonataAdminBundle instead of dev-master, or run composer require sonata-project/core-bundle dev-master so that it exceeds the minimum requirement of ~2.2 for SonataCoreBundle in the composer.json file of SonataAdminBundle. Then run composer update to fix all of the dependencies.

Symfony2 without Doctrine

How can I install symfony2 without Doctrine?
I have tried removing the package using composer and uninstalling the bundle manually but I get errors always.
My application is going to get the data from a Restful WS, so I don't need Doctrine at all.
Create a Symfony Standard Edition project with the Symfony installer:
symfony new symfony-se
Remove the doctrine/doctrine-bundle and doctrine/orm from your composer.json.
Remove the DoctrineBundle from a list of registered bundles in AppKernel.
Remove the doctrine configuration from the app/config/config.yml. You can also remove database related entries from the app/config/parameters.yml.dist.
Run composer update.
Note that you'll still find some of the doctrine packages installed. For example the doctrine/annotations library is used by Symfony to parse annotations. Doctrine is not only an ORM.

Twig syntax error when enabling ESI in symfony 2.1.8

Ive attempted to add an ESI render with {'standalone': true} to one of my twig templates and am getting the TWIG syntax error of:
Unexpected token "punctuation" of value "," ("end of statement block" expected) in AccommMiddleBundle:Home:layout.html.twig at line 155
here is the relevant twig template block:
150 <div class="container">
151 <h1>{{ blog_articles.0.title }}</h1>
152 Moose
153 </div>
154
155 {% render url('accomm_middle_home_recent_articles', {fred: 1}), {'standalone': true} %}
156
157 {% set charity_url = "http://www.accommodation.com/charity" %}
Removing the , {'standalone': true} gets the template to render fine.
Im using Symfony 2.1.8 with a clean vendors and there seems to be no differences with the standard edition dependencies. Any ideas on how to debug this ?
thanks for any help
MikeB
p.s. here are my installed packages
AccomDotCom/AccomDotComRESTClientBundle 0.1 The RESTFul models for talking to the Accommodation.com privateapi (baghdadsquirrel) via symfony
behat/behat v2.4.5 Scenario-oriented BDD framework for PHP 5.3
behat/gherkin v2.2.9 Gherkin DSL parser for PHP 5.3
behat/mink v1.4.3 Web acceptance testing framework for PHP 5.3
behat/mink-browserkit-driver v1.0.4 Symfony2 BrowserKit driver for Mink framework
behat/mink-extension v1.0.1 Mink extension for Behat
behat/mink-selenium2-driver v1.0.5 Selenium2 (WebDriver) driver for Mink framework
behat/mink-zombie-driver v1.0.3 Zombie.js driver for Mink framework
behat/symfony2-extension v1.0.1 Symfony2 framework extension for Behat
doctrine/common 2.3.0 Common Library for Doctrine projects
doctrine/dbal 2.3.2 Database Abstraction Layer
doctrine/doctrine-bundle v1.0.0 Symfony DoctrineBundle
doctrine/orm 2.3.2 Object-Relational-Mapper for PHP
guzzle/guzzle v2.8.7 Guzzle is a PHP HTTP client library and framework for building RESTful web service clients
instaclick/php-webdriver 1.0.12 PHP WebDriver for Selenium 2
jms/aop-bundle 1.0.0 Adds AOP capabilities to Symfony2
jms/cg 1.0.0 Toolset for generating PHP code
jms/di-extra-bundle 1.1.1 Allows to configure dependency injection using annotations
jms/metadata 1.1.1 Class/method/property metadata management in PHP
jms/security-extra-bundle 1.2.0 Enhances the Symfony2 Security Component by adding several new features
kriswallsmith/assetic v1.1.0-alpha4 Asset Management for PHP
monolog/monolog 1.2.1 Logging for PHP 5.3
nelmio/esi-debug-bundle 1.0.0 Shows you caching information around ESI requests for debugging purposes
sensio/distribution-bundle v2.1.8 The base bundle for the Symfony Distributions
sensio/framework-extra-bundle v2.1.8 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v2.1.8 This bundle generates code for you
swiftmailer/swiftmailer v4.2.2 Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle v2.1.2 Integrates Assetic into Symfony2
symfony/monolog-bundle v2.1.8 Symfony MonologBundle
symfony/swiftmailer-bundle v2.1.8 Symfony SwiftmailerBundle
symfony/symfony v2.1.8 The Symfony PHP framework
twig/extensions dev-master v1.0.0 Common additional features for Twig that do not directly belong in core
twig/twig v1.12.2 Twig, the flexible, fast, and secure template language for PHP
vipsoft/jira-extension v1.0.9 Load features for Behat from Jira issues
In Symfony2.1, to adapt your render block to the correct notation, you need to
put your arguments between single quote ' : in this case you would have'fred': 1
Add the with{} statement even if it's empty:
Which gives you:
{% render url('accomm_middle_home_recent_articles', {'fred': 1}) with {}, {'standalone': true} %}
Note: It looks like the with{} statement is absolutely needed in Symfony2.1, from this security release. However, Symfony might have changed this recently and I don't think it is needed in Symfony2.2 anymore.
{# the with argument is needed but ignored #}
And an example they provide with it:
{% render url("path_to_controller_router", { 'param': 1 }) with {}, { 'standalone': true } %}

Categories