2016-07-05 2 views
-1

StofDoctrineExtensionsBundlelink과 동일하게 설치했습니다. 대조적으로 페이지 렌더링은 약 5 분이므로 매우 느리게 렌더링됩니다. 사용자 엔티티 (FOSUSERBUNDLE)에서 의 플러시 가능 기능 만 필요합니다. 나는 그것이 몇 가지 요소없이 더 빨리 작동한다고 생각한다.SYMFONY2 최소 구성

이 패키지에서만 실행할 수있는 최소 구성은 무엇입니까? 모든 매핑이 필요합니까 (link 참조)?

config.yml 예가 필요합니다.

편집 청취자를 추가 한 후 내 config.yml 보인다 : slugg와

... 
    orm: 
     default_entity_manager: default 
     auto_generate_proxy_classes: "%kernel.debug%" 
     entity_managers: 
      default: 
       connection: default 
       mappings: 
        AppBundle: ~ 
        gedmo_translatable: 
         type: annotation 
         prefix: Gedmo\Translatable\Entity 
         dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity" 
         alias: GedmoTranslatable # (optional) it will default to the name set for the mapping 
         is_bundle: false 
        gedmo_translator: 
         type: annotation 
         prefix: Gedmo\Translator\Entity 
         dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity" 
         alias: GedmoTranslator # (optional) it will default to the name set for the mapping 
         is_bundle: false 
        gedmo_loggable: 
         type: annotation 
         prefix: Gedmo\Loggable\Entity 
         dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity" 
         alias: GedmoLoggable # (optional) it will default to the name set for the mappingmapping 
         is_bundle: false 
        gedmo_tree: 
         type: annotation 
         prefix: Gedmo\Tree\Entity 
         dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity" 
         alias: GedmoTree # (optional) it will default to the name set for the mapping 
         is_bundle: false 

... 
stof_doctrine_extensions: 
    class: 
     sluggable:  ~ 
... 

내 법인 :

namespace AppBundle\Entity; 
use Gedmo\Mapping\Annotation as Gedmo; 
use Doctrine\ORM\Mapping as ORM; 

/** 
* Profile 
* 
* @ORM\Table(name="profile") 
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProfileRepository") 
*/ 
class Profile 
{ 
    /** 
    * @var int 
    * 
    * @ORM\Column(name="id", type="integer") 
    * @ORM\Id 
    * @ORM\GeneratedValue(strategy="AUTO") 
    */ 
    private $id; 

    /** 
    * @var string 
    * 
    * @ORM\Column(name="name", type="string", length=150, nullable=true) 
    */ 
    private $name; 
    /** 
    * @Gedmo\Slug(fields={"title", "name"}) 
    * @ORM\Column(length=128, unique=true) 
    */ 
    private $slug; 
    /** 
    * @var string 
    * 
    * @ORM\Column(name="city", type="string", length=150, nullable=true) 
    */ 
    private $city; 

    /** 
    * @var string 
    * 
    * @ORM\Column(name="voivodeship", type="string", length=50, nullable=true) 
    */ 
    private $voivodeship; 

    /** 
    * @var string 
    * 
    * @ORM\Column(name="description", type="text", nullable=true) 
    */ 
    private $description; 

    /** 
    * @var string 
    * 
    * @ORM\Column(name="category", type="string", length=100, nullable=true) 
    */ 
    private $category; 


    /** 
    * 
    * @ORM\OneToOne(targetEntity="User", cascade={"persist"}) 
    * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) 
    */ 
    protected $user; 
    /** 
    * Get id 
    * 
    * @return int 
    */ 
    public function getId() 
    { 
     return $this->id; 
    } 

    /** 
    * Set name 
    * 
    * @param string $name 
    * 
    * @return Profile 
    */ 
    public function setName($name) 
    { 
     $this->name = $name; 

     return $this; 
    } 

    /** 
    * Get name 
    * 
    * @return string 
    */ 
    public function getName() 
    { 
     return $this->name; 
    } 

    /** 
    * Set city 
    * 
    * @param string $city 
    * 
    * @return Profile 
    */ 
    public function setCity($city) 
    { 
     $this->city = $city; 

     return $this; 
    } 

    /** 
    * Get city 
    * 
    * @return string 
    */ 
    public function getCity() 
    { 
     return $this->city; 
    } 

    /** 
    * Set voivodeship 
    * 
    * @param string $voivodeship 
    * 
    * @return Profile 
    */ 
    public function setVoivodeship($voivodeship) 
    { 
     $this->voivodeship = $voivodeship; 

     return $this; 
    } 

    /** 
    * Get voivodeship 
    * 
    * @return string 
    */ 
    public function getVoivodeship() 
    { 
     return $this->voivodeship; 
    } 

    /** 
    * Set description 
    * 
    * @param string $description 
    * 
    * @return Profile 
    */ 
    public function setDescription($description) 
    { 
     $this->description = $description; 

     return $this; 
    } 

    /** 
    * Get description 
    * 
    * @return string 
    */ 
    public function getDescription() 
    { 
     return $this->description; 
    } 

    /** 
    * Set category 
    * 
    * @param string $category 
    * 
    * @return Profile 
    */ 
    public function setCategory($category) 
    { 
     $this->category = $category; 

     return $this; 
    } 

    /** 
    * Get category 
    * 
    * @return string 
    */ 
    public function getCategory() 
    { 
     return $this->category; 
    } 

    /** 
    * Set user 
    * 
    * @param \AppBundle\Entity\User $user 
    * 
    * @return Profile 
    */ 
    public function setUser(\AppBundle\Entity\User $user = null) 
    { 
     $this->user = $user; 

     return $this; 
    } 

    /** 
    * Get user 
    * 
    * @return \AppBundle\Entity\User 
    */ 
    public function getUser() 
    { 
     return $this->user; 
    } 
    /** 
    * Get slug 
    * 
    * @return string 
    */ 
    public function getSlug() 
    { 
     return $this->slug; 
    } 
} 

이제 사이트는 발생하지 않았다. 상쾌 데이터베이스와 아무것도

도움 에서만 sluggable 청취자 활성화해야

답변

1

내가 수정 한 청취자 정의 알사스의 대답에서와 지금 일하고있어 .

# app/config/config.yml 
stof_doctrine_extensions: 
default_locale: en 
orm: 
    default: 
     tree: false 
     timestampable: false 
     sluggable: true 
     translatable: false 
1

:

# app/config/config.yml 
stof_doctrine_extensions: 
    class: 
     sluggable:  ~ 

을 그리고 당신의 슬러그 속성을 만들 :

<?php 
namespace Entity; 

use Gedmo\Mapping\Annotation as Gedmo; 
use Doctrine\ORM\Mapping as ORM; 

/** 
* @ORM\Table(name="articles") 
* @ORM\Entity 
*/ 
class Entity 
{ 
    ... 

    /** 
    * @Gedmo\Slug(fields={"username"}) 
    * @ORM\Column(length=128, unique=true) 
    */ 
    private $slug; 

    ... 
} 
+0

리스너를 추가 한 후 아무 것도 변경되지 않았습니다. 내 파일의 질문을 완료했습니다 –

+0

당신은 내가 쓴 것을 필요로합니다. 매핑에서 모든 리스너를 제거하십시오 ... – Alsatian

+0

잘못된 구성 (normaly 4)으로 생성 된 모든 원치 않는 SQL 테이블을 제거하는 것을 잊지 마십시오. – Alsatian