22847 Posts in 9589 Topics by 2802 members
|Go to End|
26 December 2009 at 11:55pm
Today I had a reflection error.
All class are ok and until yesterday, I don't have any type of error.
I create a new Page B class into mysite with a class B1 that extend Image class.
Into Product Class, I just have a class with another name B2 that extend Image class.
In Admin panel when I upload image file, I have everytime reflection error that B2 class don't exist ( when I was on Page B ) or B1 don't exist ( when I was on Product ).
I resolved putting B1 and B2 into main Page class that extend SiteTree.
27 December 2009 at 4:06pm
What exactly do you mean by "new Page B class ... with a class B1?" Do you mean that Page B has a B1 as in a one-to-one database relationship?
How all this will work for you will depend on the actual names of your classes. You need to do a ?flush=1 once you've added your classes, of course. You also need to make sure the autoloader, with the help of the manifest builder, is going to find your classes. I'm no expert on exactly what will and won't be found, but note this from the manifest builder documentation:
"If your class contains an underscore, for example, Page_Controller, then the filename is expected to be the stuff before the underscore. In this case, Page.php.''
27 December 2009 at 10:37pm
thank you for your reply.
With Page B class , I mean class SpecialDataPage extends Page and into the same file I specified B1 class extend Image and B2 class was putted before Product Class into the same php file.
All works before I created SpecialDataPage.
Do you think the problem was class name ( class Resize_Image extends Image & class Banner_Image extends Image )?
PS: I flush everytime at each update...
28 December 2009 at 4:20pm
Yes, I think you should try moving B1 and B2 out into their own files (B1.php and B2.php).
Classes in MyFile.php should be just MyFile and MyFile_*.
And regarding your resolution:
"If you don't know why it works it probably doesn't -- you just don't know it yet"
- Steve McConnell, "Code Complete"
28 December 2009 at 10:17pm
I think that I rename "class Resize_Image extends Image & class Banner_Image extends Image" to ResizeImage and BannerImage...
30 December 2009 at 6:34am
I had resolved with your tip ...
class Product_ResizeImage extends Image into product.php file
class SpecialDataPage_BannerImage extends Image into SpecialDataPage.php file.
|Go to Top|