来自Symfony4的学说供应商,'坚持' method在参数中使用一个实体。我想创建我自己的apersist函数,它在参数中获取一个实体数组,如何通过一种新方法覆盖自定义类的EntityManager-> persist方法' apersist'像这样 ?
class MyEm extends EntityManager
{
public function apersist($entities){
foreach($entities as $entity){
// ?? (I tried with '$this->persist($entity)' or 'parent::persist($entity)' but I get errors)
}
}
来自班级管理员:
public function create(MyEm $mem){ // I get errors when I try use my MyEm class from create parameter
$entities[] = new foo();
$entities[] = new foo();
$mem->apersist($entities);
}