Assetic not found in Symfony 2.8 and 3.0 - symfony

I am starting a new Symfony project. After I type:
symfony new project-name
I see that the new project is created but I don't find the Assetic bundle inside the project. Also if I try:
app/console
I don't find the following commands:
assetic:dump
assetic:watch
Could somebody help me? What am I doing wrong. Is something wrong with the files I download?

The Assetic Bundle isn't included since SF 3.2. I think this is caused by some compatibility issues.
You can add them manually to your composer.json
"symfony/assetic-bundle": "~2",
And add the new Bundle to your Kernel.
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
Then it should work. I use SF 2.8 and its working. There are some deprecation warnings and i don't know if its working under SF3.

AsseticBundle was only removed from the standard distribution in 2.8. This means that if you wish to use Assetic, you may still do so, by including the dependency manually, by running:
composer require symfony/assetic-bundle
And adding the bundle in your AppKernel:
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
One thing to know, though. AsseticBundle has not yet been migrated to 3.0.
Thus, you won't be able to use it (for now) if you wish to start a 3.0 project.
That's also the case for quite a few bundles (and among them the Sonata bundles), and even though some developers have started work on migrating to 3.0 release before the official release, last week, some bundles still need quite a lot work to be made compatible with 3.0.
Hopefully, AsseticBundle (and other) should be migrated over the next months. Or if you're impatient, you can still contribute to Assetic, or AsseticBundle! ;)
Edit: AsseticBundle should be tagged by the end of the month, if not before, as stof said in this issue: https://github.com/symfony/assetic-bundle/issues/401

Related

Bundles don't automatically create their .yaml files

I've been trying to create and setup a project under Symfony 4.4 for a few hours now but it seems like i'm getting a problem when i'm downloading bundles or installing things (For example, Doctrine or FOSrest).
Multiple times in tutorials I've seen that all the people seemed to have files such as "Doctrine.yaml" which are supposed to be stored in config/packages. And it seems like these configuration files are automatically created upon downloading the files associated to it.
But in my case there's simply... nothing, I have to create manually all the files, and i'm not sure if that's normal and if not, how can I resolve this problem ?
And it seems like these configuration files are automatically created upon downloading the files associated to it.
You're looking for the Symfony recipes which allow composer packages via Symfony/flex to automate common tasks when you install a new bundle.
A more detailed explanation regarding how does flex work you'll find in the official documentation here when it was first introduced in Symfony 3.4, but note that is not maintained anymore for this version.
I corrected it. I simply was being too dumb. When I created the git repository, I did the installation wrong and I didn't immediatly notice that I was downloading things into the wrong repository.
Thanks for all the answers!

Jboss Fuse 6.2, install custom features to profile in fabric

I was able to do what I'm goin to describe in Fuse 6.1 but now in Fuse 6.2 I get an exception and it is not working anymore.
By following a tutorial, I build a "multi module" project that has a features component in order to install all the needed bundles.
I'm working on a fabric container with a child container.
I create a new profile and then from hawtio console I try to add the feature repository. (BTW I have the same problem if I use the terminal console)
The feature repository is added correctly (that's what fuse says at least) but when I enter the page to add any feature I see this in the log:
org.eclipse.aether.resolution.ArtifactResolutionException: Could not
find artifact it.mytria.demo:esercizio1-feature:xml:features:1.0.0 in
karaf-default
(file:C:/servers/fuse/system/)
Of course, it is right, since I never installed the bundle in that folder, but I have it in my local .m2/repository
Now, the question is, has anyone ever installed a custom feature in Jboss 6.2 and can help me get out from this situation?
The only solution I found is to manually copy the feature and all the custom bundled indicated by the feature in the "/system" folder, but I never had to do this in Fuse 6.1 so I don't like this solution at all.
Other thing, there is a conf file in Fuse 6.2 that has changed from Fuse 6.1, C:\servers\fuse\etc\io.fabric8.maven.cfg and it is the only file I found pointing to the system folder... but I'm afraid that if I add the .m2 folder here then Fuse will try to search there any bundle even those that has to be really taken from system folder.
So far I haven't find any other difference in the config file about maven repository.
There is any good guy out there that know how to make this thing work?
Please, if I missed some important information, let me know, I'll try my best to complete the question.
Thank you very much.
I installed a clean JbossFuse 6.2.0. Then from the hawtio console I just add the repository to the profile using
mvn:it.mytria.demo/esercizio1-feature/1.0.0/xml/features
and it worked.
So... I have no idea what went wrong the first time. I made no changes to the projects code or pom configuration of the bundles.

Can Updating symfony2 with composer break my website?

I recently downloaded a new symfony2 package for websockets and included it into my composer file,
when I called
php composer.phar update
It automatically updated my Symfony version and I was wondering if updating Symfony2 will break the website in the long run, since part of my source code could become obsolete (deprecated)
Yes, if composer downloads a version of a dependency that's not backward compatible with the version that you used to develop your website, things might/will break.
However, you can limit the possibility by defining good rules in your composer.json.
First of all, it might be good to learn about semantic versioning if you haven't heard of it already. Many projects are following the rules of semantic versioning, which basically state that if a project/library has changed in a way that is not compatible with earlier versions, it's main version number should be incremented. For instance, if 1.5.x had a certain feature, and an update is made where that feature is changed or no longer available, the new version number should be 2.0.x instead of 1.6.x.
Knowing this, you can use Composer's tilde operator (~) to define useful version constraints. For instance, to add the dependency to symfony's files, you can add the following requirement to your composer.json:
"symfony/symfony": "~2.3"
which is equivalent to:
"symfony/symfony": ">=2.3,<3.0"
or, in plain English: 'give me a version of symfony/symfony, at least version 2.3 or higher, but lower than 3.0'. If Symfony follows semantic versioning correctly, no backward incompatible changes should be made in any 2.x versions (and, if any backward incompatible changes are made, they should come with version 3.0), so you should be fine.
This actually depends on how your composer.json is configured. If your dependencies use SemVer, and you are referencing them in your composer.json only allowing patch version changes (like "package-name": "1.1.x"), then everything should usually be fine.
Also, note that you can pass a package name as a parameter to the composer update command, e.g. php composer.phar update <vendor/dependency-name>. This will tell Composer to only check if there are updates available to <dependency-name> package, given your current composer.json version constraints.
If you want to check that nothing is broken after an update and you're not keeping the update scope as narrow as I specified, then something could break. The best way to detect and avoid this is by testing.
You should read about composer.lock file. This will make sure that Composer will not update any version of the repository and only what you specify in the lock file

Sylius Installation - ProductBundle is Missing

I'm new in sylius development and I'm getting trouble to install some sylius bundles. I want to build a small online store and I pretend to use SyliusProductBundle, SyliusCartBundle and the required SyliusResourcesBundle.
How can I add them to my project?
Just to test, I've downloaded and installed the sylius full stack and I've noticed that the ProductBundle isn't there. I've read the documentation of both ProductBundle and CartBundle. The ProductBundle was replaced?
So, I have 2 problems:
Figure out what bundles should I use (I think Product and Cart but ProcuctBundle is aparently missing)
How to install this standalone bundles via composer.
I'm using symfony 2.3.1
As far as I'm aware the product bundle is still active (last commit was 7 days ago). To install and use the product bundle specifically, follow these steps from the docs:
http://docs.sylius.com/en/latest/bundles/SyliusProductBundle/installation.html
You can install any other bundle stand alone by adding the package, as found on packagist, to your composer.json file and running composer update <packagename>. The sylius bundles are here:
https://packagist.org/packages/sylius/
In terms of the specific bundles you'll need, there are 2 places you'll be able to learn more:
Documentation - covers integrating product, cart and resource bundles pretty well. The remaining bundles are WIP.
Sylius Demo - the features and the last successful travis build will give you the best indication of the functionality supported by Sylius.

Is the master branch of symfony production ready?

I use the 2.0.x version in my project, but recently I've started to see more and more bundles that support only the master branch
Should I migrate to the master branch?
It's not stable and may contain unfinished code. Also, there are a lot of break changes that haven't been documented yet. If you're starting a new project, then go for master, if you have already written some code, I'd better wait for the next 2.1 release (all bundles should support it).
Most popular bundles work with 2.0 too, but you must often use the branch for your symfony version, not a bundle's master branch.

Resources