Inheritance: extends AppModel
Exemple #1
0
 /**
  * @param Replay $replay
  * @param BinaryReader $br
  * @param Actor $actor
  * @return ActorProperty
  */
 public static function deserialize($replay, $br, $actor)
 {
     $id = bindec(strrev($br->readBits($actor->getPropertyBits())));
     $class = $actor->properties[$id];
     $property = new self($id, $class);
     return new self();
 }
 function autocompletecobrador()
 {
     $vendedor = new Actor();
     $text = $_REQUEST['term'];
     $datos = $vendedor->buscaautocompletevcobrador($text);
     echo json_encode($datos);
 }
Exemple #3
0
function readJson($jsonfile, $db)
{
    $str = file_get_contents($jsonfile);
    $json = json_decode($str, true);
    //print_r ($json);
    $bill = new Bill($json);
    //print $bill->toString();
    if ($bill->link_id === "") {
        echo "Bill ID Needed for {$entry}!";
        exit(-1);
    }
    $bill->insert($db);
    // Let's work on the actors
    foreach ($json['proposers'] as $a) {
        $actor = new Actor($a);
        $actor->is_proposer = 1;
        $actor->is_representative = is_representative($actor->name, $json['status_infos']);
        $actor->insert($db);
        $actor->insertCoActor($db, $bill->id);
        //print $actor->toString() . "\n";
    }
    foreach ($json['withdrawers'] as $a) {
        $actor = new Actor($a);
        $actor->is_withdrawer = 1;
        $actor->insert($db);
        $actor->insertCoActor($db, $bill->id);
        //print $actor->toString() . "\n";
    }
}
 /**
  * Filters by an Agent or an identified Group.
  *
  * @param Actor $actor The Actor to filter by
  *
  * @return self The statements filter
  *
  * @throws \InvalidArgumentException if the Actor is not identified
  */
 public function byActor(Actor $actor)
 {
     if (null === $actor->getInverseFunctionalIdentifier()) {
         throw new \InvalidArgumentException('Actor must be identified');
     }
     $this->filter['agent'] = $actor;
     return $this;
 }
 public function actionAdmin()
 {
     $model = new Actor('search');
     $model->unsetAttributes();
     if (isset($_GET['Actor'])) {
         $model->setAttributes($_GET['Actor']);
     }
     $this->render('admin', array('model' => $model));
 }
 /**
  * Function	: listado
  * Author	: Fernando Garcia Atuncar
  */
 function listado()
 {
     $data = new Actor();
     $actor = $data->listadoActor();
     $total = count($actor);
     for ($i = 0; $i < $total; $i++) {
         $actor[$i]['contrasena'] = $this->Desencripta($actor[$i]['contrasena']);
     }
     $datos['listaactor'] = $actor;
     $this->view->show("/seguridad/listado.phtml", $datos);
 }
 function creaguiaped()
 {
     $_SESSION['Autenticado'] = true;
     $vendedor = new Actor();
     $ordenVenta = new OrdenVenta();
     $url = "/" . $_REQUEST['url'];
     $data['Documento'] = $this->tipoDocumento();
     $data['Vendedor'] = $vendedor->listadoVendedoresTodos();
     $data['FormaPago'] = $this->formaPago();
     $data['CondicionLetra'] = $ordenVenta->condicionesletra();
     $data['TipoLetra'] = $this->tipoLetra();
     $data['ModoFacturacion'] = $this->modoFacturacion();
     //$data['Codigo']=$ordenVenta->generaCodigo();
     $data['codigov'] = $_REQUEST['id'];
     $this->view->show("/ventas/ordenventa.phtml", $data);
 }
Exemple #8
0
 /**
  * {@inheritdoc}
  */
 public function equals(Actor $actor)
 {
     if (!parent::equals($actor)) {
         return false;
     }
     if ('Xabbuh\\XApi\\Model\\Agent' !== get_class($actor)) {
         return false;
     }
     return true;
 }
Exemple #9
0
 /**
  * {@inheritdoc}
  */
 public function equals(Object $actor)
 {
     if (!parent::equals($actor)) {
         return false;
     }
     /** @var Group $actor */
     if (count($this->members) !== count($actor->members)) {
         return false;
     }
     foreach ($this->members as $member) {
         if (!in_array($member, $actor->members)) {
             return false;
         }
     }
     return true;
 }
 /**
  * @param $array
  * @return mixed
  */
 private function processGraph($array)
 {
     if (!is_array($array)) {
         return null;
     }
     $output = array();
     foreach ($array as $key => $group) {
         if (is_array($group)) {
             foreach ($group as $item) {
                 if (is_array($item) && array_key_exists('peerindex_id', $item)) {
                     $output[$key][] = Actor::getInstance($item);
                 }
             }
         }
     }
     return $output;
 }
 public function actionAr()
 {
     $actors = Actor::model()->findAll(array('with' => 'films', 'order' => 't.first_name, t.last_name, films.title'));
     echo "<ol>";
     foreach ($actors as $actor) {
         echo "<li>";
         echo $actor->first_name . ' ' . $actor->last_name;
         echo "<ol>";
         foreach ($actor->films as $film) {
             echo "<li>";
             echo $film->title;
             echo "</li>";
         }
         echo "</ol>";
         echo "</li>";
     }
     echo "</ol>";
 }
Exemple #12
0
 /**
  * {@inheritdoc}
  */
 public function equals(Actor $actor)
 {
     if (!parent::equals($actor)) {
         return false;
     }
     if ('Xabbuh\\XApi\\Model\\Group' !== get_class($actor)) {
         return false;
     }
     /** @var Group $actor */
     if (count($this->members) !== count($actor->members)) {
         return false;
     }
     foreach ($this->members as $member) {
         if (!in_array($member, $actor->members)) {
             return false;
         }
     }
     return true;
 }
Exemple #13
0
 public function equals(Context $context)
 {
     if ($this->registration !== $context->registration) {
         return false;
     }
     if (null !== $this->instructor xor null !== $context->instructor) {
         return false;
     }
     if (null !== $this->instructor && null !== $context->instructor && !$this->instructor->equals($context->instructor)) {
         return false;
     }
     if (null !== $this->team xor null !== $context->team) {
         return false;
     }
     if (null !== $this->team && null !== $context->team && !$this->team->equals($context->team)) {
         return false;
     }
     if ($this->contextActivities != $context->contextActivities) {
         return false;
     }
     if ($this->revision !== $context->revision) {
         return false;
     }
     if ($this->platform !== $context->platform) {
         return false;
     }
     if ($this->language !== $context->language) {
         return false;
     }
     if (null !== $this->statement xor null !== $context->statement) {
         return false;
     }
     if (null !== $this->statement && null !== $context->statement && !$this->statement->equals($context->statement)) {
         return false;
     }
     if (null !== $this->extensions xor null !== $context->extensions) {
         return false;
     }
     if (null !== $this->extensions && null !== $context->extensions && !$this->extensions->equals($context->extensions)) {
         return false;
     }
     return true;
 }
Exemple #14
0
 private function CreateActor($i)
 {
     $actor = new Actor();
     $data = array();
     $data['title'] = $_POST['title' . $i];
     $data['name'] = $_POST['name' . $i];
     $data['role'] = $_POST['role' . $i];
     if (!empty($_FILES['picture' . $i]['tmp_name'])) {
         $url = $this->uploadImage($_FILES['picture' . $i]);
         if ($url != false) {
             $data['picture'] = $url;
         }
     } else {
         $data['picture'] = "";
     }
     $sql = mysql_query("SELECT * FROM Movies WHERE title LIKE '%" . $_POST['title'] . "%'");
     $result = mysql_fetch_assoc($sql);
     $data['movie_id'] = $result['m_id'];
     $actor->setActor($data);
     return $actor;
 }
Exemple #15
0
     $smarty->assign("menu", $_SESSION['user']->getGroup());
     $smarty->assign("content", "parameters");
     $smarty->assign("paramcontent", $menu . $action);
     break;
 case 'Save':
     $smarty->assign("title", "Gestionnaire des paramètres");
     $smarty->assign("paramtitle", "Liste des acteurs");
     $smarty->assign("menu", $_SESSION['user']->getGroup());
     $smarty->assign("content", "parameters");
     $smarty->assign("paramcontent", "actorList");
     $smarty->assign("actorList", $_SESSION['actorList']);
     $smarty->assign("size", $_SESSION['actorsize']);
     break;
 case 'Update':
     $actorId = $_SESSION["actorId"] = $_GET["id"];
     $actor = Actor::getOneActor($actorId);
     $smarty->assign("actor", $actor);
     $smarty->assign("title", "Gestionnaire des paramètres");
     $smarty->assign("paramtitle", "Modification d'un acteur");
     $smarty->assign("menu", $_SESSION['user']->getGroup());
     $smarty->assign("content", "parameters");
     $smarty->assign("paramcontent", $menu . $action);
     break;
 case 'Delete':
     $smarty->assign("title", "Gestionnaire des paramètres");
     $smarty->assign("paramtitle", "Gestionnaire des catégories");
     $smarty->assign("menu", $_SESSION['user']->getGroup());
     $smarty->assign("content", "parameters");
     $smarty->assign("paramcontent", $menu);
     $smarty->assign("categoryList", $_SESSION['categoryList']);
     break;
Exemple #16
0
 /**
  * Creates a new actor and sets the role character
  * Used in /tvshow/actions/updateTVShowFromForm
  *
  * @param TVShow $movie_object
  * @param String $actor
  */
 public static function createActorInTVShow($tvshow_object, $actor)
 {
     $actor_obj = new Actor();
     $actor_obj->name = $actor['actor'];
     $actor_obj->photo = Util::changePathSeparators(Util::makePath(array(sfConfig::get('app_actors_rel'), $actor['actor'] . '.jpg')));
     $actor_obj->TVShows[] = $tvshow_object;
     $actor_obj->save();
     $q = Doctrine_Query::create()->update('TVShowActor ta')->set('ta.role', '?', $actor['character'])->where('ta.tvshow_id = ?', $tvshow_object['id'])->andWhere('ta.actor_id = ?', $actor_obj['id'])->execute();
     return $actor_obj;
 }
Exemple #17
0
// 创建父类
$p1 = new Person("jack", 23);
echo $p1->getAge() . '<br/>';
Person::showNation();
var_dump($p1);
// 调用父类的静态方法
Person::getSpeed();
Person::SpeedUp();
// 调用受保护的方法
echo $p1->showList();
// 创建子类
$a1 = new Actor();
var_dump($a1);
// unset($a1);
// 调用子类的静态方法
Actor::start();
/* 如果构造函数定义成了私有方法,则不允许直接实例化对象了,这时候一般通过静态方法进行实例化,
       在设计模式中会经常使用这样的方法来控制对象的创建,比如单例模式只允许有一个全局唯一的对象 
*/
class Car
{
    private function __construct()
    {
        echo 'object create';
    }
    private static $_object = null;
    public static function getInstance()
    {
        if (empty(self::$_object)) {
            self::$_object = new Car();
            //内部方法可以调用私有方法,因此这里可以创建对象
 function ventas()
 {
     $linea = new Linea();
     $vendedor = new Actor();
     if (count($_REQUEST) == 6) {
         $tamanio = 10;
         $ordenVenta = new OrdenVenta();
         $linea = new Linea();
         $vendedor = new Actor();
         $data['linea'] = $linea->listadoLineas('idpadre=0');
         $data['vendedor'] = $vendedor->listadoVendedoresTodos();
         $data['Paginacion'] = $ordenVenta->Paginacion($tamanio);
         $data['Pagina'] = 1;
         $this->view->show('/reporte/ventas.phtml', $data);
     } else {
         $idLinea = $_REQUEST['linea'];
         $idVendedor = $_REQUEST['vendedor'];
         $fInicial = $_REQUEST['fechaInicial'];
         $fFinal = $_REQUEST['fechaFinal'];
         $ordenVenta = new OrdenVenta();
         $data = $ordenVenta->listadoReporteVentas($idLinea, $idVendedor, $fInicial, $fFinal);
         //$data = $ordenVenta->listadoReporteVentas($idLinea, $idVendedor, '2012/09/07', '2012/09/07');
         //$objeto = $this->formatearparakui($data);
         //header("Content-type: application/json");
         echo json_encode($data);
     }
 }
/* @var $this UseCaseController */
/* @var $model UseCase */
/* @var $form CActiveForm */
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'use-case-form', 'enableAjaxValidation' => false));
?>

<!-- DropDown to be copied -->
<div style='display:none'>
<?php 
echo $form->dropDownList(Actor::model(), 'id_actor', CHtml::listData(Actor::model()->findAll(), 'id_actor', 'description'));
?>
</div>
<!-- end DropDown to be copied-->

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'parent');
?>
        <?php 
Exemple #20
0
echo $form->labelEx($model, 'last_update');
?>
		<?php 
echo $form->textField($model, 'last_update');
?>
		<?php 
echo $form->error($model, 'last_update');
?>
		</div><!-- row -->

		<label><?php 
echo GxHtml::encode($model->getRelationLabel('actors'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'actors', GxHtml::encodeEx(GxHtml::listDataEx(Actor::model()->findAllAttributes(null, true)), false, true));
?>
		<label><?php 
echo GxHtml::encode($model->getRelationLabel('categories'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'categories', GxHtml::encodeEx(GxHtml::listDataEx(Category::model()->findAllAttributes(null, true)), false, true));
?>
		<label><?php 
echo GxHtml::encode($model->getRelationLabel('inventories'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'inventories', GxHtml::encodeEx(GxHtml::listDataEx(Inventory::model()->findAllAttributes(null, true)), false, true));
?>
 function reprogramar()
 {
     $Actor = new Actor();
     $letras = new Letras();
     $tipoGasto = $this->AutoLoadModel('tipogasto');
     $data['cobrador'] = $Actor->listadoCobradores();
     $Ingresos = new Ingresos();
     $data['letras'] = $letras->listado();
     $data['ingresos'] = $Ingresos->listarxhoy();
     $data['tipoGasto'] = $tipoGasto->listaxCriterio(3);
     $this->view->show('/ingresos/reprogramar.phtml', $data);
 }
 public function director()
 {
     global $database;
     $sql = "SELECT * FROM actors WHERE id=" . $this->id . " LIMIT 1";
     $result_array = Actor::find_by_sql($sql);
     return !empty($result_array) ? array_shift($result_array) : false;
 }
Exemple #23
0
 private function mutate()
 {
     // order the populating into most to least fit
     $this->actors = $this->get_best_fit($this->population);
     // get most fit actors to mutate
     $mutators = array_slice($this->actors, 0, $this->breeders);
     // clear out the population and rebuild it from the best fit
     $this->actors = array();
     while (count($this->actors) < $this->population) {
         // mix 'em up
         shuffle($mutators);
         for ($i = 0; $i < $this->breeders; $i++) {
             $actor = new Actor();
             // get code
             $code = $mutators[$i]->get_code();
             // chance of mutation...
             if ($this->mutate_actor()) {
                 // find a random spot in the code
                 $pos = mt_rand(0, strlen($code));
                 $symbol = substr($actor->symbols, mt_rand(0, strlen($actor->symbols) - 1), 1);
                 $code = substr_replace($code, $symbol, $pos, 1);
             }
             // insert the code
             $actor->init($code);
             // Update the population
             $this->actors[] = $actor;
         }
     }
 }
 public function hasActiveContract(Actor $actor)
 {
     foreach ($actor->getContracts() as $contract) {
         if ($contract->getAgreement()->getStatus() == 'Active') {
             return true;
         }
     }
     return false;
 }
 function buscarDetalleOrdenCobroEstadoGuia()
 {
     $idOrdenVenta = $_REQUEST['id'];
     $dataGuia = $this->AutoLoadModel("OrdenVenta");
     $idTipoCambio = $dataGuia->BuscarCampoOVxId($idOrdenVenta, "IdTipoCambioVigente");
     //PREGUNTAR SI ACTUAL O AL ELEGIDO EN LA COMPRA
     $TipoCambio = $this->AutoLoadModel("TipoCambio");
     $dataTipoCambio = $TipoCambio->consultaDatosTCVigentexTCElegido($idTipoCambio);
     $simboloMoneda = $dataTipoCambio[0]['simbolo'];
     $TC_PrecioVenta = $dataTipoCambio[0]['venta'];
     $ordencobro = new OrdenCobro();
     $dataOrdenCobro = $ordencobro->listarxguia($idOrdenVenta);
     $detalleOrdenCobro = new DetalleOrdenCobro();
     $cantidadOrdenCobro = count($dataOrdenCobro);
     $actor = new Actor();
     $tipoGasto = $this->AutoLoadModel('tipogasto');
     for ($n = 0; $n < $cantidadOrdenCobro; $n++) {
         $dataDetalleOrdenCobro = $detalleOrdenCobro->listadoxidOrdenCobro($dataOrdenCobro[$n]['idordencobro']);
         $tamanio = count($dataDetalleOrdenCobro);
         echo "\t<tr>\n\t\t\t\t\t\t<tH colspan=14><h3>DETALLE DE LA PROGRAMACION DE PAGOS:</h3></tH>\n\t\t\t\t\t</tr>";
         echo "<tr>";
         echo "<th>Nro:</th>";
         echo "<th>Padre:</th>";
         echo "<th>Monto:</th>";
         echo "<th>Saldo:</th>";
         echo "<th>Condicion:</th>";
         echo "<th>Nro letra:</th>";
         echo "<th>Fecha Giro:</th>";
         echo "<th>Fecha<br> Vencimiento:</th>";
         echo "<th>Fecha<br> Pago:</th>";
         echo "<th>Situación:</th>";
         echo "<th>Tipo Gasto:</th>";
         echo "<th>Usuario Mod.:</th>";
         echo "<th>N° Unico</th>";
         echo "<th>R. de letra :</th>";
         echo "</tr>";
         for ($i = 0; $i < $tamanio; $i++) {
             $dataActor = $actor->buscarxid($dataDetalleOrdenCobro[$i]['usuariomodificacion']);
             echo "<tr>";
             echo "<td>" . $dataDetalleOrdenCobro[$i]['iddetalleordencobro'] . "</td>";
             echo "<td>" . (empty($dataDetalleOrdenCobro[$i]['idpadre']) ? '' : $dataDetalleOrdenCobro[$i]['idpadre']) . "</td>";
             echo "<td>" . ' ' . $simboloMoneda . ' ' . number_format($dataDetalleOrdenCobro[$i]['importedoc'], 2) . "</td>";
             echo "<td>" . ' ' . $simboloMoneda . ' ' . number_format($dataDetalleOrdenCobro[$i]['saldodoc'], 2) . "</td>";
             switch ($dataDetalleOrdenCobro[$i]['formacobro']) {
                 case '1':
                     $formacobro = "Contado";
                     break;
                 case '2':
                     $formacobro = "Crédito";
                     break;
                 case '3':
                     $formacobro = "Letras";
                     break;
             }
             echo "<td>" . $formacobro . "</td>";
             echo "<td>" . $dataDetalleOrdenCobro[$i]['numeroletra'] . "</td>";
             echo "<td>" . $dataDetalleOrdenCobro[$i]['fechagiro'] . "</td>";
             echo "<td>" . $dataDetalleOrdenCobro[$i]['fvencimiento'] . "</td>";
             echo "<td>" . $dataDetalleOrdenCobro[$i]['fechapago'] . "</td>";
             $situacion = $dataDetalleOrdenCobro[$i]['situacion'] == '' ? 'pendiente ref (' . $dataDetalleOrdenCobro[$i]['referencia'] . ')' : $dataDetalleOrdenCobro[$i]['situacion'] . ' ref (' . $dataDetalleOrdenCobro[$i]['referencia'] . ')';
             echo "<td>" . $situacion . "<input type='hidden' value=" . $dataDetalleOrdenCobro[$i]['iddetalleordencobro'] . " class='iddetalleordencobro'></td>";
             echo "<td >" . $tipoGasto->nombreGasto($dataDetalleOrdenCobro[$i]['tipogasto']) . "</td>";
             echo "<td >" . ($dataActor[0]['nombres'] . ' ' . $dataActor[0]['apellidopaterno'] . ' ' . $dataActor[0]['apellidomaterno']) . "<button style='font-size:5;heigth:5;width:15' class='motivo' value='" . $dataDetalleOrdenCobro[$i]['motivo'] . "'>..</button></td>";
             if ($dataDetalleOrdenCobro[$i]['formacobro'] == 3) {
                 echo "<td><input class='numerounico' size='8' maxlength='11' type='text' value='" . $dataDetalleOrdenCobro[$i]['numerounico'] . "' readonly></td>";
                 echo "<td></a><input type='text' value='" . $dataDetalleOrdenCobro[$i]['recepcionLetras'] . "' class='recepcionLetra uppercase ' size='1' maxlength='2' readonly > <br><a href='' class='editar'><img src='/imagenes/editar.gif' >  <a class='grabar' href=''><img width='21' heigth='21' src='/imagenes/grabar.gif' ></a> </td>";
             } else {
                 echo "<td></td>";
             }
             echo "</tr>";
         }
         echo "<tr>";
         echo "<th>Monto :</th>";
         echo "<td><b>" . ' ' . $simboloMoneda . ' ' . number_format($dataOrdenCobro[$n]['importeordencobro'], 2) . "</b></td>";
         echo "<th>Saldo :</th>";
         echo "<td><b>" . ' ' . $simboloMoneda . ' ' . number_format($dataOrdenCobro[$n]['saldoordencobro'], 2) . "</b></td>";
         echo "<th>Situación :</th>";
         echo "<td><b>" . $dataOrdenCobro[$n]['situacion'] . "</b></td>";
         echo "<th colspan=9>&nbsp</th>";
         echo "</tr>";
         echo "<tr><td>&nbsp</td></tr>";
     }
 }
 function grabaActor()
 {
     $data = $_REQUEST['Actor'];
     $data['estado'] = 1;
     $a = new Actor();
     $exito = $a->grabaActor($data);
     $ruta['ruta'] = "/actor/listado";
     $this->view->show("ruteador.phtml", $ruta);
 }
<?php

if (isset($_GET["actorid"])) {
    require "../Business/Actor.php";
    Actor::delete($_GET["actorid"]);
    $searchTextGET = "";
    if (isset($_GET['searchText'])) {
        $searchTextGET = "&searchText=" . $_GET['searchText'];
    }
    header("Location: actors.php?pageNum=" . $_GET['pageNum'] . $searchTextGET);
} else {
    $searchTextGET = "";
    if (isset($_GET['searchText'])) {
        $searchTextGET = "&searchText=" . $_GET['searchText'];
    }
    header("Location: actors.php?pageNum=" . $_GET['pageNum'] . $searchTextGET);
}
Exemple #28
0
<?php

$this->breadcrumbs = array(Actor::label(2), 'Index');
$this->menu = array(array('label' => 'Create' . ' ' . Actor::label(), 'url' => array('create')), array('label' => 'Manage' . ' ' . Actor::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Actor::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Actor the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Actor::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #30
0
 public function executeProcessForm(sfWebRequest $request)
 {
     ini_set('display_errors', false);
     $data = array();
     $util = new Util();
     $data = $request->getPostParameter("data");
     $q = Doctrine_Query::create()->update('Movie')->set('name_org', '?', $data['name_org'])->set('director', '?', $data['director'])->set('rating', '?', $data['rating'])->set('plot', '?', $data['plot'])->where('id = ?', $data['id']);
     $rows = $q->execute();
     $movie = Doctrine::getTable('Movie')->findOneById($data['id']);
     //year
     if ($data['year'] == "") {
         $movie->Year = NULL;
         $movie->save();
     } else {
         $year_object = Doctrine::getTable('Year')->findOneByName($data['year']);
         if ($year_object == NULL) {
             $year_object = new Year();
             $year_object->name = $data['year'];
             $year_object->coverMo = $util->changePathSeparators($util->makePath(array(sfConfig::get('app_years_rel'), '_' . $util->unformatName($data['year']) . '.jpg')));
             $year_object->coverMu = $util->changePathSeparators($util->makePath(array(sfConfig::get('app_years_rel'), $util->unformatName($data['year']) . '.jpg')));
             $year_object->save();
         }
         $movie->Year = $year_object;
         $movie->save();
     }
     //country
     if ($data['country'] == "") {
         $movie->Country = NULL;
         $movie->save();
     } else {
         $country_object = Doctrine::getTable('Country')->findOneByName($data['country']);
         if ($country_object == NULL) {
             $country_object = new Country();
             $country_object->name = $data['country'];
             $country_object->cover = $util->changePathSeparators($util->makePath(array(sfConfig::get('app_countries_rel'), $util->unformatName($data['country']) . '.png')));
             $country_object->save();
         }
         $movie->Country = $country_object;
         $movie->save();
     }
     //genres
     foreach ($data['genres'] as $genre) {
         $genre_object = Doctrine::getTable('Genre')->findOneByName($genre);
         //if this not exist let's create it
         if ($genre_object == NULL) {
             $genre_object = new Genre();
             $genre_object->name = $genre;
             $genre_object->cover = $util->changePathSeparators($util->makePath(array(sfConfig::get('app_genres_rel'), $util->unformatName($genre) . '.jpg')));
             $genre_object->Movies[] = $movie;
             $genre_object->save();
         } else {
             //check if the movie already has such Genre
             $found = false;
             foreach ($movie['MovieGenre'] as $db_genre) {
                 if ($db_genre['Genre']['name'] == $genre) {
                     $found = true;
                 }
             }
             if ($found == false) {
                 $genre_object->Movies[] = $movie;
                 $genre_object->save();
             }
         }
     }
     //removing the db genres which are not in the request
     foreach ($movie['MovieGenre'] as $db_genre) {
         $found2 = false;
         foreach ($data['genres'] as $genre) {
             if ($db_genre['Genre']['name'] == $genre) {
                 $found2 = true;
             }
         }
         if ($found2 == false) {
             $q = Doctrine_Query::create()->delete('MovieGenre')->addWhere('movie_id = ?', $db_genre['movie_id'])->andWhere('genre_id = ?', $db_genre['genre_id']);
             $deleted = $q->execute();
         }
     }
     //actors
     foreach ($data['actors'] as $item) {
         $actor_object = Doctrine::getTable('Actor')->findOneByName($item['actor']);
         //if this not exist let's create it
         if ($actor_object == NULL) {
             $actor_object = new Actor();
             $actor_object->name = $item['actor'];
             $actor_object->cover = $util->changePathSeparators($util->makePath(array(sfConfig::get('app_actors_rel'), $util->unformatName($item['actor']) . '.jpg')));
             $actor_object->Movies[] = $movie;
             $actor_object->save();
             $q = Doctrine_Query::create()->from('MovieActor ma')->where('ma.movie_id = ?', $movie['id'])->andWhere('ma.actor_id = ?', $actor_object['id']);
             $movie_actor = $q->execute();
             $movie_actor[0]->role = $item['character'];
             $movie_actor[0]->save();
         } else {
             //check if the movie already has such Actor
             $found = false;
             foreach ($movie['MovieActor'] as $db_actor) {
                 if ($db_actor['Actor']['name'] == $item['actor']) {
                     $found = true;
                 }
             }
             if ($found == false) {
                 $movie_actor = new MovieActor();
                 $movie_actor->actor_id = $actor_object['id'];
                 $movie_actor->movie_id = $movie['id'];
                 $movie_actor->role = $item['character'];
                 $movie_actor->save();
             }
         }
     }
     //removing the db genres which are not in the request
     foreach ($movie['MovieActor'] as $db_actor) {
         $found2 = false;
         foreach ($data['actors'] as $item) {
             if ($db_actor['Actor']['name'] == $item['actor']) {
                 $found2 = true;
             }
         }
         if ($found2 == false) {
             $q = Doctrine_Query::create()->delete('MovieActor')->addWhere('movie_id = ?', $db_actor['movie_id'])->andWhere('actor_id = ?', $db_actor['actor_id']);
         }
         $deleted = $q->execute();
     }
     //var_dump($data);
     exit;
 }