public function indexAction() { // action body /* @var $repo \Models\Repositories\MovieRepository */ $repo = MyEntityManagerFactory::getEntityManager()->getRepository('\\Models\\Entities\\Movie'); $this->view->movie = $repo->find($this->getParam('id')); if ($this->view->movie) { VideoService::getInstance()->viewMovie($this->getParam('id')); $this->view->relatedMovies = $repo->__findRandomRelatedMovies($this->getParam('id')); } $repo->clear(); }
/** * @PreUpdate * @PrePersist */ public function processUrl() { if ($this->isProcessUrl) { $vids = VideoService::getInstance()->getRealVideo($this->getRealUrl()); $this->setProcessedUrl($vids); } }
<?php use Models\Services\VideoService; defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); defined('PUBLIC_PATH') || define('PUBLIC_PATH', realpath(dirname(__FILE__))); // // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH), get_include_path(), realpath(PUBLIC_PATH)))); error_reporting(E_ALL); date_default_timezone_set('Asia/Bangkok'); // create autoloader require_once 'Zend/Loader/Autoloader.php'; $loader = \Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('My\\'); $loader->registerNamespace("Doctrine\\"); $loader->registerNamespace("Models\\"); $vs = VideoService::getInstance(); $sourceUrl = 'https://plus.google.com/photos/106135027719844357910/albums/5970312833136615089/5970595871311426930?pid=5970595871311426930&oid=106135027719844357910'; $vs->getRealVideo($sourceUrl);