public function setEntityState($entity, $new)
    {
        $current = $this->getEntityState($entity);

        if ($this->_state_machine->stateChanged($entity, $current, $new) === true) {
            if ($new & AnDomain::STATE_CLEAN) {
                unset($this->_states[$entity]);
            } else {
                $this->_states[$entity] = $new;
                $this->insertEntity($entity);
            }

            return true;
        }

        return false;
    }
public function setEntityState($entity, $new)
    {
        $current = $this->getEntityState($entity);

        if ($this->_state_machine->stateChanged($entity, $current, $new) === true) {
            if ($new & AnDomain::STATE_CLEAN) {
                unset($this->_states[$entity]);
            } else {
                $this->_states[$entity] = $new;
                $this->insertEntity($entity);
            }

            return true;
        }

        return false;
    }
public function setEntityState ( $ entity , $ new ) { $ current = $ this -> getEntityState ( $ entity ) ; if ( $ this -> _state_machine -> stateChanged ( $ entity , $ current , $ new ) === true ) { if ( $ new & AnDomain :: STATE_CLEAN ) { unset ( $ this -> _states [ $ entity ] ) ; } else { $ this -> _states [ $ entity ] = $ new ; $ this -> insertEntity ( $ entity ) ; } return true ; } return false ; }
Set an entity state return whether if the state change was succesful.

@param AnDomainEntityAbstract $entity Domain entity
@param int                    $new    New state

@return bool Return whether the state for the entity has been set sucesfully
Set an entity state return whether if the state change was succesful .