public function getNotes()
 {
     $this->__load();
     return parent::getNotes();
 }
예제 #2
0
/**
 * Creates or updates customer notes from given member array by type.
 *
 * @param string             $title   Note title
 * @param string             $contemt Note content
 * @param \Entities\Customer $cust    Customer to update or create notes
 * @param object             $em      Doctrine entity manager.
 * @return void
 */
function createUpdateNote($title, $content, $cust, $em)
{
    $cnote = false;
    if ($cust->getNotes()) {
        foreach ($cust->getNotes() as $tnote) {
            if ($tnote->getTitle() == $title) {
                $cnote = $tnote;
                break;
            }
        }
    }
    if (!$cnote) {
        $cnote = new \Entities\CustomerNote();
        $em->persist($cnote);
        $cnote->setCustomer($cust);
        $cust->addNote($cnote);
        $cnote->setTitle($title);
        $cnote->setPrivate(1);
        $cnote->setCreated(new \DateTime());
    }
    $cnote->setUpdated(new \DateTime());
    $cnote->setNote($content);
}