2015-01-03 2 views
0

내가 같이 updateSingleValue 사용하고 올바른 :updateSingleValue는()가 false를 돌려, 아직 입력

$updated = $this->app['storage']->updateSingleValue('suggestions', $id, 'votes', $value); 

$id$value 제대로 (I 수동 정수를 해결하도록 설정 한 경우에도)를 설정하고,이 확실히 suggestions 콘텐츠 유형이 votes 필드로 존재합니다. 그러나이 함수는 false을 반환하므로 !$this->isValidColumn($field, $contenttype)이 실패 함을 나타냅니다.

JSON 형식의 suggestion은 다음과 같습니다

suggestion": { 
"id": "25", 
"values": { 
    "datechanged": "2015-01-03 13:25:02", 
    "id": "25", 
    "slug": "slug-o2sbdb", 
    "datecreated": "2015-01-03 13:25:02", 
    "datepublish": "2015-01-03 13:25:02", 
    "datedepublish": "1900-01-01 00:00:00", 
    "ownerid": "1", 
    "status": "published", 
    "title": "test title", 
    "description": "test description", 
    "votes": "0" 
}, 

제안의 컨텐트 유형은 다음과 같습니다

suggestions: 
    name: Suggestions 
    slug: suggestions 
    singular_name: Suggestion 
    singular_slug: suggestion 
    default_status: publish 
    fields: 
     title: 
      label: Title 
      type: text 
      class: large 
      required: true 
      pattern: ".{2,255}" # see: http://html5pattern.com/ 
      error: "The Title field is required, and must contain at least 2 characters" 
     description: 
      label: Description 
      type: textarea 
     votes: 
      label: Votes 
      type: integer 

내가 잘못 여기서 뭘 할 수 있습니까?

답변

0

여기에서 문제가 발견되면 updateSingleValue에 전달 된 contenttype은 슬러그 '제안'이 아닌 전체 contenttype이어야합니다. 저장소 클래스 메서드를 통해 가져올 수 있습니다.

$app['storage']->getContentType('suggestions') 

그런 다음 그 결과를 updateSingleValue 메서드에 전달하십시오.

관련 문제