Skip to content

Instantly share code, notes, and snippets.

@dsyph3r
Created April 27, 2011 07:25
Show Gist options
  • Save dsyph3r/943844 to your computer and use it in GitHub Desktop.
Save dsyph3r/943844 to your computer and use it in GitHub Desktop.
Blog: Doctrine 1: Overriding the Constructor
$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"));
Creating new blog...
isNew: true
Saving blog...
isNew: false
Retrieving blog...
isNew: true
public function construct() {
// Some additional functionality
parent::construct();
}
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