Created
April 27, 2011 07:25
-
-
Save dsyph3r/943844 to your computer and use it in GitHub Desktop.
Blog: Doctrine 1: Overriding the Constructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->log("Creating new blog..."); | |
$blog = new Blog(); | |
$blog->setAuthor("Author"); | |
$blog->setComment("Hello, World"); | |
$this->log("isNew: " . (($blog->isNew()) ? "true" : "false")); | |
$blog->save(); | |
$this->log("\nSaving blog..."); | |
$this->log("isNew: " . (($blog->isNew()) ? "true" : "false")); | |
$this->log("\nRetrieving blog..."); | |
$dbBlog = Doctrine::getTable('Blog')->find(1); | |
$this->log("isNew: " . (($dbBlog->isNew()) ? "true" : "false")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating new blog... | |
isNew: true | |
Saving blog... | |
isNew: false | |
Retrieving blog... | |
isNew: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function construct() { | |
// Some additional functionality | |
parent::construct(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function __construct() { | |
// Some additional functionality | |
parent::__construct(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment