public function getEntityName($_route = null)
    {
        if($_route == null) {
            $request = $this->get('request_stack')->getCurrentRequest();
            $_route = $request->attributes->get('_route');
        }
        $parts = explode('.', $_route);
        if(count($parts) == 2) {
            $namespace = $parts[0];
        }
        $_route = end($parts);
        $parts = explode('_', $_route);
        if(count($parts) > 1) {
            $entity = $parts[count($parts)-2];
        } else {
            $parts = explode(':', $_route);
            if(count($parts) == 2) {
                $entity = strtolower($parts[1]);
            }
        }
        //if((count($parts)-2) == -1) die(var_dump($_route));
        //die(var_dump(count($parts)));
        //die(var_dump($entity));
        return $entity;
    }
public function getEntityName($_route = null)
    {
        if($_route == null) {
            $request = $this->get('request_stack')->getCurrentRequest();
            $_route = $request->attributes->get('_route');
        }
        $parts = explode('.', $_route);
        if(count($parts) == 2) {
            $namespace = $parts[0];
        }
        $_route = end($parts);
        $parts = explode('_', $_route);
        if(count($parts) > 1) {
            $entity = $parts[count($parts)-2];
        } else {
            $parts = explode(':', $_route);
            if(count($parts) == 2) {
                $entity = strtolower($parts[1]);
            }
        }
        //if((count($parts)-2) == -1) die(var_dump($_route));
        //die(var_dump(count($parts)));
        //die(var_dump($entity));
        return $entity;
    }
public function getEntityName ( $ _route = null ) { if ( $ _route == null ) { $ request = $ this -> get ( 'request_stack' ) -> getCurrentRequest ( ) ; $ _route = $ request -> attributes -> get ( '_route' ) ; } $ parts = explode ( '.' , $ _route ) ; if ( count ( $ parts ) == 2 ) { $ namespace = $ parts [ 0 ] ; } $ _route = end ( $ parts ) ; $ parts = explode ( '_' , $ _route ) ; if ( count ( $ parts ) > 1 ) { $ entity = $ parts [ count ( $ parts ) - 2 ] ; } else { $ parts = explode ( ':' , $ _route ) ; if ( count ( $ parts ) == 2 ) { $ entity = strtolower ( $ parts [ 1 ] ) ; } } //if((count($parts)-2) == -1) die(var_dump($_route)); //die(var_dump(count($parts))); //die(var_dump($entity)); return $ entity ; }
return entity name as "entity"
return entity name as entity