Situation 1 - Nettoyage du code - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Situation 1 - Nettoyage du code.php
- <?php
- function creer_une_nouvelle_categorie_avec_des_attributs(string $label, array $donneesDesAttributes, bool $creerLesAttributs = true): Category
- {
- /** @var Category $category */
- $category = CategoryRepository::getInstance()->findOneByLabel($label);
- if (!$category instanceof Category) {
- $catogeryBuilder = new CategoryBuilder();
- $ma_nouvelle_categorie = $catogeryBuilder->createNewCategory();
- $ma_nouvelle_categorie->setLabel($label);
- foreach ($donneesDesAttributes as $label_de_l_attribut => $d) {
- if ($creerLesAttributs and $d['create']) {
- $constructeur_d_attribut = new AttributeBuilder();
- $mon_nouvel_attribut = $constructeur_d_attribut->createNewAttribute($label_de_l_attribut);
- $mon_nouvel_attribut->setValueType($d['value_type']);
- }
- $ma_nouvelle_categorie->addAttribute($mon_nouvel_attribut);
- }
- }
- $category = $ma_nouvelle_categorie;
- return $category;
- }
File Description
- Situation 1 - Nettoyage du code
- PHP Code
- 01 Feb-2021
- 1014 Bytes
You can Share it:
Latest PHP Pastes