Skip to content

Commit

Permalink
UPDATE: use Class Change Function
Browse files Browse the repository at this point in the history
Switched back to using $this->ClassName = instead of
$this->newClassInstance() as per stack exchange discussion
http://stackoverflow.com/questions/26695285/trouble-with-newclassinstanc
e-in-onbeforewrite?noredirect=1#comment42014296_26695285
  • Loading branch information
Richard Rudy committed Nov 4, 2014
1 parent 22b9653 commit 5c54767
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/Pages/Listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,11 @@ function onBeforeWrite() {
}

if(($this->Status == "Available" || $this->Status == "Sold") && $this->ClassName != "Listing") {
$this->newClassInstance("Listing");
//$this->newClassInstance("Listing");
$this->ClassName('Listing');
} elseif( ( $this->Status == "Unavailable" || $this->Status == "Closed") && $this->ClassName != "UnavailableListing") {
$this->newClassInstance("UnavailableListing");
//$this->newClassInstance("UnavailableListing");
$this->ClassName('UnavailableListing');
}
}

Expand Down

0 comments on commit 5c54767

Please sign in to comment.