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
$history = new EventHistory(); | |
$backlog = $history->getHistory(); | |
$result = []; | |
foreach($backlog as $k => $log) { | |
$result[$k] = new stdClass(); | |
$result[$k]->date = $log->get('updatedAt')->format('d-m-Y'); | |
$result[$k]->time = $log->get('updatedAt')->format('h:ia'); | |
var_dump($log->get('staff')); | |
//$result[$k]->staff = $log->get('staff')->get('nickName'); |
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
<?php | |
/** | |
* Output filtered event history | |
*/ | |
class EventHistory { | |
protected $em; | |
public function __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
<?php | |
/* | |
* Copyright (c) 2012, John Hamelink | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* * Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. |
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
<?php | |
class Ajax_Staff_Controller extends Base_Controller { | |
private $em; | |
public function __construct() { | |
$this->em = EntityManager::getInstance(); | |
} |
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
// Get the company repository | |
$repo = EntityManager::getInstance()->getRepository('company'); | |
// For each row we need to insert | |
foreach ($this->input as $row) { | |
// Find a company | |
$company = $repo->findOneBy(['ticker' => $row['Ticker']]); | |
if ($company == null) { | |
$warnings[] = $row['Ticker'] . ' could not be found in the database'; | |
continue; |
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 addToDB() { | |
$warnings = []; | |
// Get the company repository | |
$repo = EntityManager::getInstance()->getRepository('company'); | |
// For each row we need to insert | |
foreach ($this->input as $row) { | |
// Find a company | |
$company = $repo->findOneBy(['ticker' => $row['Ticker']]); | |
if ($company == null) { |
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
$em = EntityManager::getInstance(); | |
$company = $em->getRepository('company')->findOne('4FB24C10D54E845C0400001D'); | |
die(); |
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
<?php | |
/** | |
* The company custom Repository holds | |
* convenience methods for generating | |
* common formulae using data in the database | |
* | |
* <code> | |
* $em->getCompanyById($id)->getEnterpriseValue(); | |
* </code> |
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
<?php | |
/** | |
* The company custom Repository holds | |
* convenience methods for generating | |
* common formulae using data in the database | |
* | |
* <code> | |
* $em->getCompanyById($id)->getEnterpriseValue(); | |
* </code> |
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
$em = EntityManager::getInstance(); | |
$company = $em->getRepository('company')->findOne('4FB24C10D54E845C0400001D'); | |
echo "<pre>"; | |
print_r($company->loadCustomMethods('companyy')->priceToEarningsRatio()); | |
die(); | |