This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 192380 - [cat70] Create method , created in a total wrong place.
Summary: [cat70] Create method , created in a total wrong place.
Status: RESOLVED INCOMPLETE
Alias: None
Product: php
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-24 03:22 UTC by Sc0tTyXL
Modified: 2011-01-17 14:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sc0tTyXL 2010-11-24 03:22:10 UTC
Product Version = NetBeans IDE Dev (Build 201011210001)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03

This code :
            // Get prco
            try {
                $prco = Project::GetByIdAndOrg( $_GET['proj_id'], $org );
            } catch ( Exception $e ) {
                return $this->ShowError( Messages::GetMessage( 'CommonNonExistant' ) );
            }

The static method GetByIdAndOrg doesnt exit so when i use the button create method to create it in the class but then i get this :

    /**
     * Customer
     * @param Customer $val Setter
     * @return Customer
     */
    public function Customer( $val = false ) {
        if ( $val !== false ) {
            if ( !($val instanceof Customer ) ) {
                throw new Exception( "Wrong object type!" );
            }
            $this->_cust = $val;
            public static

            function GetByIdAndOrg($_GET, $org) {
                
            }
        }

        if ( !isset( $this->_cust ) ) {
            $this->_cust = Customer::Get($this->_cust_id);
        }

        return $this->_cust;
    }


It creates the funtion within an existing function + not on one line aswell , when i do CTRL+Z on the class i get :

    /**
     * Customer
     * @param Customer $val Setter
     * @return Customer
     */
    public function Customer( $val = false ) {
        if ( $val !== false ) {
            if ( !($val instanceof Customer ) ) {
                throw new Exception( "Wrong object type!" );
            }
            $this->_cust = $val;
public static function GetByIdAndOrg($_GET, $org) {

}
        }

        if ( !isset( $this->_cust ) ) {
            $this->_cust = Customer::Get($this->_cust_id);
        }

        return $this->_cust;
    }


I set to P2 because i think this is quite critical
Comment 1 Jiri Kovalsky 2010-11-30 18:15:02 UTC
This belongs to CND I guess. Guys, please evaluate. Thanks!
Comment 2 Jiri Kovalsky 2010-11-30 18:16:26 UTC
Oh, sorry. I meant another bug. Reassigning to PHP for evaluation.
Comment 3 pgebauer 2010-12-03 09:18:33 UTC
I'm sorry but I'm not able to reproduce the issue from above steps. Could you please be more specific? For example I would like to know a class name where the first code snippet  (marked as "This code:") belongs into and what a button you mean in the sentence "when i use the button create method".
Comment 4 Sc0tTyXL 2010-12-06 09:58:18 UTC
The class name is a cammelcase class name, i've had it in multiple classes so i dont think the name is emportant. You could use SubCategory.

With the button i mean the red icon on the left side (where the line numbers are )
Comment 5 Petr Pisl 2010-12-10 13:51:48 UTC
I have tried to reproduce the bug as well without a success. It worked for me correctly. Is it possible to attach your file where it fails?

It strange that you get an error (red square). There shouldn't be an error during such refactoring. The error is probably the reason why it's not working for you. What's the error is saying?
Comment 6 Petr Pisl 2011-01-17 14:14:28 UTC
I don't have enough informations for this. Please reopen when you will be able to reproduce or provide more information. 

IMHO the wrong behavior was because the file already was wrong before the refactoring.