Symfony 3 | JMSi18nRoutingBundle exclude SonataMediaBundle routes - symfony-2.7

Guys I use JMSi18nRoutingBundle with some JMS bundles too, so I wanted to exclude sonata media routes, so i tried : i18n = false
by this code
media:
resource: '#SonataMediaBundle/Resources/config/routing/media.xml'
prefix: /media
options: { i18n: false }
also i tried:
media:
resource: '#SonataMediaBundle/Resources/config/routing/media.xml'
prefix: /media
options:
i18n: false
but i still got the links like this:
http://mysite.local/app_dev.php/en/uploads/media/Slider/0001/03/405f4n41adb162399344690cf85143c52a0ed147.jpeg

Related

Vue and spring boot with sub-path

How i can change sub-path from / to /new ?
If i do like this:
https://cli.vuejs.org/config/#publicpath
After this i get error becouse my static paths change from /static to /new/static in index.html:
but in project structure path doesn't change:
And becouse of it i get error in my site.
I need paths doesn't change in index.html how i can do it?
my vue.config.js :
Module.exports = {
devServer: {
server: 'https',
proxy: {
'/api': {
target: 'http://localhost:8098', // this configuration needs to correspond to the Spring Boot backends' application.properties server.port
ws: true,
changeOrigin: true
},
}
},
publicPath: '/new/',
outputDir: 'target/dist',
assetsDir: 'static',
}
My project from this fork:
https://github.com/jonashackt/spring-boot-vuejs
Help please

404 on i18n json files

I'm trying to enable i18n json files with SSR on assets folder following this docs:
https://sap.github.io/spartacus-docs/i18n/
But when enabled, all files in PT folder results 404 error.
Here's my provideConfig on spartacus-configuration.module.ts file:
and my assets folder:
Thanks for your time, have a nice day!
Looks like it's trying to load a bunch of json files that aren't in your directories.
What I did on mine was I provided original Spartacus translations then I added mine below that:
provideConfig(<I18nConfig>{
i18n: {
resources: translations,
chunks: translationChunksConfig,
fallbackLang: 'en'
},
}),
provideConfig(<I18nConfig>{
i18n: {
backend: {
loadPath: 'assets/i18n-assets/{{lng}}/{{ns}}.json',
chunks: {
footer: ['footer']
}
}
},
})
otherwise, you can try to add those files its complaining about (orderApproval.json, savedCart.json, etc) to your 'pt' folder (not sure what language that is but perhaps Spartacus doesn't come with translations for it)

Nuxt static pages with Strapi i18n and dynamic deep routes mixes up components

I use Strapi with Nuxt and i18n to produce a static site in English and Danish.
The site should be able to produce URLs like these:
mysite.com/
mysite.com/da
mysite.com/news/a-story
mysite.com/da/nyheder/en-historie
mysite.com/cases/a-case
mysite.com/da/case/en-case
I have a pages folder structure like this
_cases
_slug.vue <-- for case pages
_news
_slug.vue <-- for news pages
_slug.vue <-- for other pages
index.vue <-- for my frontpage
I use the following code to list links for nice URLs that renders just fine
h2 case
router-link(:to="localePath({ name: 'cases-slug', params: { cases: $t('slugs.cases'), slug: aCasePage.slug }})") {{aCasePage.title}}
h2 news
router-link(:to="localePath({ name: 'news-slug', params: { news: $t('slugs.news'), slug: aNewsPage.slug }})") {{aNewsPage.title}}
The problem is, that no matter if I click and go to a news page or a case page, I get served the same _cases -> _slug.vue component.
Looking into the .nuxt/router.js file, the routes seems to be generated correct:
routes: [{
path: "/da",
component: _1ea75fec,
name: "index___da"
}, {
path: "/da/:slug",
component: _2214a27c,
name: "slug___da"
}, {
path: "/da/:cases/:slug?",
component: _3a25cd77,
name: "cases-slug___da"
}, {
path: "/da/:news/:slug?",
component: _3988eeb6,
name: "news-slug___da"
}, {
path: "/",
component: _1ea75fec,
name: "index___en"
}, {
path: "/:slug",
component: _2214a27c,
name: "slug___en"
}, {
path: "/:cases/:slug?",
component: _3a25cd77,
name: "cases-slug___en"
}, {
path: "/:news/:slug?",
component: _3988eeb6,
name: "news-slug___en"
}],
How can I avoid Nuxt mixing up these routes? and the page Vue-components matched to them?
can you share you solution for the _slug pages data fetching ?
I am using findOne (slug,_locale:i18n.locale) from strapi .it's not working
so still hold on this issue

symfony 5.1 Bundle migration result in No mapping information to process

I'm developing a Symfony 5.1 project under DDD, so I'm changing a bit all the default folders.
I have 2 bundles inside src folder and at the moment I only have entities inside one of them.
I generated the Entity User and its repository with the command make:user and then moved the files and changed namespaces, routes, configs, etc
When I run php bin/console make:migration I get an error "No mapping information to process"
$ run php bin/console make:migration -v
In NoMappingFound.php line 13:
[Doctrine\Migrations\Provider\Exception\NoMappingFound]
No mapping information to process
The folders are:
src
|-- Smartlink
|-- UserBundle/SmartlinkUserBundle.php
|-- Application
|-- Domain
| |-- Entity/User.php
| |-- interfaces/UserRepository.php
|-- Infrastructure
|-- Repository/MysqlUserRepository.php
The configuration is:
// composer.json
"autoload": {
"psr-4": {
"UserBundle\\": "src/Smartlink/UserBundle",
"SmartlinkBundle\\": "src/Smartlink/SmartlinkBundle",
"App\\": "src/"
}
},
===============================================
// config/bundles.php
return [
...
UserBundle\SmartlinkUserBundle::class => ['all' => true],
SmartlinkBundle\SmartlinkSmartlinkBundle::class => ['all' => true],
];
===============================================
// config/services.yaml
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
UserBundle\:
resource: '../src/Smartlink/UserBundle/'
exclude:
- '../src/Smartlink/UserBundle/Domain/Entity/'
SmartlinkBundle\:
resource: '../src/Smartlink/SmartlinkBundle/'
exclude:
- '../src/Smartlink/SmartlinkBundle/Domain/Entity/'
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
- '../src/Smartlink/'
===============================================
// config/routes/annotations.yaml
userbundle_controllers:
resource: ../../src/Smartlink/UserBundle/Infrastructure/Controller
type: annotation
smartlinkbundle_controllers:
resource: ../../src/Smartlink/SmartlinkBundle/Infrastructure/Controller
type: annotation
controllers:
resource: ../../src/Controller/
type: annotation
kernel:
resource: ../../src/Kernel.php
type: annotation
===============================================
// config/packages/doctrine.yaml
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
SmartlinkUserBundle:
is_bundle: true
type: annotation
dir: 'Domain/Entity'
alias: user_bundle
SmartlinkSmartlinkBundle:
is_bundle: true
type: annotation
dir: 'Domain/Entity'
alias: smartlink_bundle
The UserRepository is the same that generated the make:user command except for the namespace, which is changed to namespace UserBundle\Infrastructure\Repository; and the name that is changed to MysqlUserRepository that implements the interface UserRepository
And the entity User is
namespace UserBundle\Domain\Entity;
use UserBundle\Infrastructure\Repository\MysqlUserRepository;
/**
* #ORM\Entity(repositoryClass=MysqlUserRepository::class)
*/
class User implements UserInterface
{
...
I've been searching and all I have found is about symfony 2 and symfony 4, I tried the same that worked for the people who was asking, but still can't generate the migration of the bundles. what am I missing?
Edit: I changed some configurations and solved the UserBundle is not found or is not active but the main migration problem remains
Finally I found an answer, the solution is in the file config/packages/doctrine.yaml
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
SmartlinkUserBundle:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Smartlink/UserBundle/Domain/Entity' # 'Domain/Entity'
prefix: 'UserBundle\Domain\Entity'
alias: UserBundle
SmartlinkSmartlinkBundle:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Smartlink/SmartlinkBundle/Domain/Entity'
prefix: 'SmartlinkBundle\Domain\Entity'
alias: SmartlinkBundle
The fix is setting in_bundle to false
the dir: was wrong, so I had to fix it
and I added the prefix, without the prefix there was an error.
And now it works.

Symfony2 cache and routing generation

this is my first attempt to create something with Symfony2.
I have my database, and I wanted to generate models from it automatically. So I run
php app/console doctrine:mapping:import MYBundle php
and
php app/console doctrine:generate:entities MYBundle
Ok, my entities are now created.
Then I wanted to create basic crud operations, so i run
php app/console generate:doctrine:crud
Which is supposed to create Controllers,Views and Routing table for the selected models.
The problem is that the routing table isn't generated, so if i navigate to, let's say, /posts, and my index.html.twig contains
path('users_show', { 'id': entity.id }) }}
My server send a 500 Error.
Symfony doesn't even catch that error and show me the nice formatted exception.
Furthermore if i modify my index.html.twig, it will remain cached until i don't rm -R the /app/cache/dev folder.
Is there a way to disable caching?
[EDIT]
my routing_dev.yml
_welcome:
pattern: /
defaults: { _controller: OREBundle:Default:index }
_assetic:
resource: .
type: assetic
_wdt:
resource: "#WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "#WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "#SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_main:
resource: routing.yml
and my routing.yml
_welcome:
pattern: /
defaults: { _controller: OREBundle:Default:index }
_users:
pattern: /users
defaults: { _controller: OREBundle:Users:index}
I'm guessing that you never ran your command with the --with-write option. From the symfony2 docs:
--with-write: (no) [values: yes|no] Whether or not to generate the new, create, edit, update and delete actions
You can try running your generate-entities again with this option.

Resources