protected function edit(ModelObject $obj)
    {
        if ($obj->{$obj->getPrimaryKey()} == null)
            $this->errors->reject("{$obj->getPrimaryKey()} is required to edit.")->throwOnError();

        if ($this->dao->getByID($obj->{$obj->getPrimaryKey()}) == false)
            $this->getErrors()->reject("Record not found for ID: " . $obj->{$obj->getPrimaryKey()})->throwOnError();

        if ($this->dao->slugExists($obj->Slug, $obj->{$obj->getPrimaryKey()}))
            $this->errors->reject("The slug for this ".get_class($obj)." record is already in use.")->throwOnError();

        $this->errors->validateModelObject($obj);
    }
protected function edit(ModelObject $obj)
    {
        if ($obj->{$obj->getPrimaryKey()} == null)
            $this->errors->reject("{$obj->getPrimaryKey()} is required to edit.")->throwOnError();

        if ($this->dao->getByID($obj->{$obj->getPrimaryKey()}) == false)
            $this->getErrors()->reject("Record not found for ID: " . $obj->{$obj->getPrimaryKey()})->throwOnError();

        if ($this->dao->slugExists($obj->Slug, $obj->{$obj->getPrimaryKey()}))
            $this->errors->reject("The slug for this ".get_class($obj)." record is already in use.")->throwOnError();

        $this->errors->validateModelObject($obj);
    }
protected function edit ( ModelObject $ obj ) { if ( $ obj -> { $ obj -> getPrimaryKey ( ) } == null ) $ this -> errors -> reject ( "{$obj->getPrimaryKey()} is required to edit." ) -> throwOnError ( ) ; if ( $ this -> dao -> getByID ( $ obj -> { $ obj -> getPrimaryKey ( ) } ) == false ) $ this -> getErrors ( ) -> reject ( "Record not found for ID: " . $ obj -> { $ obj -> getPrimaryKey ( ) } ) -> throwOnError ( ) ; if ( $ this -> dao -> slugExists ( $ obj -> Slug , $ obj -> { $ obj -> getPrimaryKey ( ) } ) ) $ this -> errors -> reject ( "The slug for this " . get_class ( $ obj ) . " record is already in use." ) -> throwOnError ( ) ; $ this -> errors -> validateModelObject ( $ obj ) ; }
Ensures we have a valid model object, and that it's slug is not in conflict,
then validates the object

@param ModelObject $obj The object to validate

@return void
Ensures we have a valid model object and that it s slug is not in conflict then validates the object