Skip to content

Instantly share code, notes, and snippets.

@jwage
Created November 29, 2010 21:18
Show Gist options
  • Save jwage/720641 to your computer and use it in GitHub Desktop.
Save jwage/720641 to your computer and use it in GitHub Desktop.
<?php
/** @Document @HasLifecycleCallbacks */
class Product
{
/** @Id */
public $id;
/** @String */
public $name;
/** @String */
public $supplierName;
/** @PrePersist @PreUpdate */
public function cacheSupplierName()
{
$this->supplierName = $this->supplier->getName();
}
}
/** @Document */
class Supplier
{
/** @Id */
public $id;
/** @String */
public $name;
public function getName()
{
return $this->name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment