src/Symbb/Core/SystemBundle/Api/AbstractCrudApi.php
public function save($object)
    {

        if (is_array($object)) {
            $objectData = $object;
            if ($object['id'] > 0) {
                $object = $this->find($object['id']);
            } else {
                $object = $this->createNewObject();
            }
            $this->assignArrayToObject($object, $objectData);
        } else if (!$this->isCorrectInstance($object)) {
            $this->addErrorMessage(self::ERROR_WRONG_OBJECT);
        }

        if (!$this->hasError()) {
            $check = $this->manager->save($object);
            if ($check) {
                $this->addSuccessMessage(self::SUCCESS_SAVED);
            }
        }

        return $object;
    }
public function save($object)
    {

        if (is_array($object)) {
            $objectData = $object;
            if ($object['id'] > 0) {
                $object = $this->find($object['id']);
            } else {
                $object = $this->createNewObject();
            }
            $this->assignArrayToObject($object, $objectData);
        } else if (!$this->isCorrectInstance($object)) {
            $this->addErrorMessage(self::ERROR_WRONG_OBJECT);
        }

        if (!$this->hasError()) {
            $check = $this->manager->save($object);
            if ($check) {
                $this->addSuccessMessage(self::SUCCESS_SAVED);
            }
        }

        return $object;
    }
public function save ( $ object ) { if ( is_array ( $ object ) ) { $ objectData = $ object ; if ( $ object [ 'id' ] > 0 ) { $ object = $ this -> find ( $ object [ 'id' ] ) ; } else { $ object = $ this -> createNewObject ( ) ; } $ this -> assignArrayToObject ( $ object , $ objectData ) ; } else if ( ! $ this -> isCorrectInstance ( $ object ) ) { $ this -> addErrorMessage ( self :: ERROR_WRONG_OBJECT ) ; } if ( ! $ this -> hasError ( ) ) { $ check = $ this -> manager -> save ( $ object ) ; if ( $ check ) { $ this -> addSuccessMessage ( self :: SUCCESS_SAVED ) ; } } return $ object ; }
save a object
you can pass the Site object or an array with the fields
if you pass an array the keys must be with underscore and not with CamelCase
@param object|array $object
@return object
save a object you can pass the Site object or an array with the fields if you pass an array the keys must be with underscore and not with CamelCase