public function persistAndFlush()
    {
        if (0 === func_num_args()) {
            throw new \LogicException('Missing arguments');
        }

        $persists = [];
        $entities = func_get_args();

        foreach ($entities as $entity) {
            if (true === is_array($entity)) {
                $persists = array_merge($persists, $entity);
            } else {
                $persists[] = $entity;
            }
        }

        foreach ($persists as $persist) {
            $this->getDoctrine()->getManager()->persist($persist);
        }

        $this->getDoctrine()->getManager()->flush();

        return $this;
    }
public function persistAndFlush()
    {
        if (0 === func_num_args()) {
            throw new \LogicException('Missing arguments');
        }

        $persists = [];
        $entities = func_get_args();

        foreach ($entities as $entity) {
            if (true === is_array($entity)) {
                $persists = array_merge($persists, $entity);
            } else {
                $persists[] = $entity;
            }
        }

        foreach ($persists as $persist) {
            $this->getDoctrine()->getManager()->persist($persist);
        }

        $this->getDoctrine()->getManager()->flush();

        return $this;
    }
public function persistAndFlush ( ) { if ( 0 === func_num_args ( ) ) { throw new \ LogicException ( 'Missing arguments' ) ; } $ persists = [ ] ; $ entities = func_get_args ( ) ; foreach ( $ entities as $ entity ) { if ( true === is_array ( $ entity ) ) { $ persists = array_merge ( $ persists , $ entity ) ; } else { $ persists [ ] = $ entity ; } } foreach ( $ persists as $ persist ) { $ this -> getDoctrine ( ) -> getManager ( ) -> persist ( $ persist ) ; } $ this -> getDoctrine ( ) -> getManager ( ) -> flush ( ) ; return $ this ; }
Persist and Flush

@return $this
Persist and Flush