• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with constructor

#1
[eluser]Unknown[/eluser]
Hi

Very strange problem - but just can't solve it. I have two almost identical classes 'Image' and 'Video' .. (Video was initially a copy of Image). Calling the Video constructor (new Video) the new instance doesn't get created although Image works fine ... is there any reason why a class can't be "Video" ?

=============== relevant code =====================
class Image extends DataMapper {

public $table = 'images';
public $has_one = array('property');
public static $folder = 'images/properties/';
//private static $

public function __construct($id = NULL)
{
parent::__construct($id);
}
===================================================
class Video extends DataMapper {

public $table = 'videos';

public $has_one = array('property');
public static $folder = 'videos/properties/';
//private static $

public function __construct($id = NULL)
{
parent::__construct($id);
}


#2
[eluser]solid9[/eluser]
I think you need to learn this too.
http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY

#3
[eluser]Unknown[/eluser]
Learn? I think un-forget would be better Smile ! Basically I'm adding to someone elses code and was rushing (too much?). I'd forgotten all about that - I'll do some revision and redo the code and see if there's any improvement!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.