ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 9947


Ignore:
Timestamp:
Jan 6, 2009, 3:29:45 PM (13 years ago)
Author:
ebihara
Message:

#3341:fixed NaviForm? allows an empty navi item

Location:
OpenPNE3/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/config/schema.yml

    r9937 r9947  
    126126    id: ~
    127127    type: { type: varchar(64), required: true, index: true }
    128     uri: { type: longvarchar }
     128    uri: { type: longvarchar, required: true }
    129129    sort_order: { type: integer }
    130130
    131131  navi_i18n:
    132     caption: { type: longvarchar }
     132    caption: { type: longvarchar, required: true }
  • OpenPNE3/trunk/lib/model/Navi.php

    r8106 r9947  
    1010class Navi extends BaseNavi
    1111{
     12  public function save(PropelPDO $con = null)
     13  {
     14    if (!$this->getSortOrder())
     15    {
     16      $maxSortOrder = 0;
     17
     18      $navis = NaviPeer::retrieveByType($this->getType());
     19      $finalNavi = array_pop($navis);
     20      if ($finalNavi)
     21      {
     22        $maxSortOrder = $finalNavi->getSortOrder();
     23      }
     24
     25      $this->setSortOrder($maxSortOrder + 10);
     26    }
     27
     28    return parent::save($con);
     29  }
    1230}
Note: See TracChangeset for help on using the changeset viewer.