Development

Changeset 12070

You must first sign up to be able to contribute.

Changeset 12070

Show
Ignore:
Timestamp:
10/08/08 14:28:29 (5 years ago)
Author:
nicolas.charlot
Message:

refactored validator existant root test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/isicsPropelNestedSetPositionPlugin/lib/validator/isicsValidatorPropelNestedSetPosition.class.php

    r12066 r12070  
    7575      if ($node->isNew()) 
    7676      { 
    77         $criteria = new Criteria(); 
    78         $criteria->add(constant(get_class($node->getPeer()).'::SCOPE_COL'), $node->getScopeIdValue()); 
    79         if (call_user_func(array($node->getPeer(), 'doCount'), $criteria, $this->getOption('connection')) > 0) 
     77        $root_node = call_user_func(array($node->getPeer(), 'retrieveRoot'), $node->getScopeIdValue(), $this->getOption('connection')); 
     78        if (!is_null($root_node)) 
    8079        { 
    8180          throw new sfValidatorError($this, 'root node already exists', array('value' => $value)); 
     
    8685      else if (!$node->isRoot()) 
    8786      { 
    88         throw new sfValidatorError($this, 'root node already exists', array('value' => $value));        
     87        throw new sfValidatorError($this, 'root node already exists', array('value' => $value)); 
    8988      } 
    9089      else