// composer.json
{
"require": {
"php": ">=8.0.2",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/asset": "6.0.*", // v6.0.3
"symfony/console": "6.0.*", // v6.0.3
"symfony/dotenv": "6.0.*", // v6.0.3
"symfony/flex": "^2", // v2.1.5
"symfony/framework-bundle": "6.0.*", // v6.0.4
"symfony/monolog-bundle": "^3.0", // v3.7.1
"symfony/runtime": "6.0.*", // v6.0.3
"symfony/twig-bundle": "6.0.*", // v6.0.3
"symfony/ux-turbo": "^2.0", // v2.0.1
"symfony/webpack-encore-bundle": "^1.13", // v1.13.2
"symfony/yaml": "6.0.*", // v6.0.3
"twig/extra-bundle": "^2.12|^3.0", // v3.3.8
"twig/twig": "^2.12|^3.0" // v3.3.8
},
"require-dev": {
"symfony/debug-bundle": "6.0.*", // v6.0.3
"symfony/stopwatch": "6.0.*", // v6.0.3
"symfony/web-profiler-bundle": "6.0.*" // v6.0.3
}
}
Woh, ¡es la hora de Symfony 6! La mejor versión de Symfony, la más fluida y la más agradable hasta la fecha, ya sea que estés construyendo una API o un frontend con JavaScript. Ah, y también es la primera versión de Symfony hecha completamente para PHP 8.
Symfony 6 trata de agilizar tu experiencia de desarrollo, poniendo soluciones a tu alcance y ayudándote a disfrutar del proceso. Porque si se hace correctamente, programar es GENIAL.
En sus marcas, listos, ¡código!
¡Vamos amigos!
Hello,
could you put tutorials about elastic search and Symfony?
it is in high demand in the job market
Hey Ruslan!
Thank you for your interest in SymfonyCasts tutorials! We don't have any certain plans to cover Codeception in the nearest future unfortunately, but I add this topic to ours idea pool, thanks! Also, we're planning to brush up our tutorials about testing, i.e. PHPUnit, PhpSpec and Behat - most probably it will happen in 2022, but no any possible release date yet too. Meanwhile, in case you're interested in Testing tools, I'd recommend you to take a look at Testing track: https://symfonycasts.com/tr...
Cheers!
Thank you.
But if you will update "Testing tutorials", don't forget about Stimulus too, please.
Hey @Ruslan!
We’re definitely planning by on a big testing update - we need it!
About Stimulus - no update is needed there. Stimulus 3 is out, but other than a renamed package name and a few minor features, it is identical to v2. But if the tutorial is not making this fact obvious enough, please let me know!
Cheers!
Hi, I wish there was a tutorial about deploying to platform.sh (apparently the recommended hosting service).
Hey @Anthony-E!
Sorry for the slow reply! It's something I'd like to do too - I'll add a vote for it on our internal tracker. If you'd like to see an example of a site deployed with platform.sh, you can see https://github.com/symfony/ux/tree/2.x/ux.symfony.com
Cheers!
U type param string $slug = null, I think better way is to type like this ?string $slug = null, or string $slug = '', bacause '' == null but '' === null is not true.
I am dynamically generating forms in Symfony 6. From the controller, I am calling a Form Type class in the traditional method. Therein, I am dynamically building some form fields based on the elements of the $options passed to the FormType
class.
public function index(Request $request): Response
{
// Entity is called Breed
$data = new Breed();
// I am passing these $options to the form
$options = [
'form_1' => true,
'form_2' => false,
'units' => 'pounds'
'form_3' => false,
];
$form = $this->createForm(BreedSurveyType::class, $data, $options);
In the BreedSurveyType form class, I am able to get my variables where I declare them in the configureOptions()
method...
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Breed::class,
'form_1' => false,
'form_2' => false,
'units' => null
'form_3' => false,
]);
}
In the buildForm()
method, I can access the $options
, but I cannot if I embed a sub-form.
public function buildForm(FormBuilderInterface $builder,array $options): void
{
// form_1 = true
// form_2 = false
// units = 'pounds'
// form_3 = true
if ($options['form_1'] === true) {
$builder->add(
'name',
AnimalNameType::class
);
}
if ($options['form_2'] === true) {
$builder->add(
'sex',
AnimalSexType::class
);
}
if ($options['form_3'] === true) {
$builder->add(
'weight',
AnimalWeightType::class
);
}
.... in the parent-form, when I dump the $options variable,
array:59 [▼
// snippet from web debug toolbar
"form_1" => true
"form_2" => false
"units" => "pounds"
"form_3" => true
]
.... in the sub-form, when I dump the $options
variable, I get the results from the declarations I made in the configureOptions()
method.
array:59 [▼
// snippet from web debug toolbar
"form_1" => false
"form_2" => false
"units" => null
"form_3" => false
]
Effectively, is there a method to pass $options
to a subform or do I need to isolate my logic of the dynamically created form in my BreedSurveyType
class?
Thank you in advance.
Hey Tom O. !
Ah, I think I understand. By "sub form", you are referring to the AnimalNameType and other Animal###Type classes, right? If you want to pass options into those, you need to do it manually via the 3rd argument to ->add()
For example. Suppose that you need to pass the units
option into a sub-form:
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if ($options['form_1'] === true) {
$builder->add(
'name',
AnimalNameType::class,
['units' => $options['units']]
);
}
// ...
}
Of course, you'll need to make sure that AnimalNameType
allows a units
option in its configureOptions()
method, but it sounds like you already have that.
Is that what you were referring to? If I completely missed the point, let me know :).
Cheers!
can not wait anymore