import { Controller } from '@hotwired/stimulus';
/** Ajoute des entrées CollectionType Symfony (prototype + __name__) pour la composition d’un match. */
export default class extends Controller {
static targets = ['holder'];
static values = {
nextIndex: { type: Number, default: 0 },
};
add(event) {
event.preventDefault();
const proto = this.holderTarget.getAttribute('data-prototype');
if (!proto) {
return;
}
const html = proto.replace(/__name__/g, String(this.nextIndexValue));
this.holderTarget.insertAdjacentHTML('beforeend', html);
this.nextIndexValue++;
}
}
Fatal error: Uncaught TypeError: Invalid return value: callable object expected, "int" returned from "/app/public/assets/controllers/match_composition_collection_controller-PvZzjK7.js". in /app/vendor/autoload_runtime.php:12
Stack trace:
#0 /app/public/index.php(5): require_once()
#1 {main}
thrown in /app/vendor/autoload_runtime.php on line 12