Commit ca9fde1f authored by Yeray Santana Hualde's avatar Yeray Santana Hualde

syncEnrollment project 1.0

parent 0f0178a5
<?php
namespace App\Console\Commands;
use App\Mail\MailSubjects;
use App\Entities\Person;
use App\Entities\EnrolmentTransition;
use DB;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use LaravelDoctrine\ORM\Facades\EntityManager;
use Illuminate\Support\Facades\Log;
class syncEnrollments extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sync:enrollments {--days=15}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Synchronize ECCAnet new enrollments';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$intervalDays = $this->option('days');
Log::info('+--------------------------------------------------------------------------------------------------------------');
Log::info('|Start process');
Log::info('+--------------------------------------------------------------------------------------------------------------');
$collectionPerIds = $this->getStudentsPerId($intervalDays);
foreach ($collectionPerIds as $collectionPerId)
{
$studentEccanetPerId = $collectionPerId->per_id;
$enrollmentCollection = $this->getEccanetStudentEnrolmentCollection($studentEccanetPerId);
$personEntity = EntityManager::getRepository(Person::class)->findOneBy(['eccanetPerId' => $studentEccanetPerId]);
//si el alumno no existe hay que crear uno
if(empty($personEntity))
{
$personEntity = new Person($studentEccanetPerId);
EntityManager::persist($personEntity);
}
//buscamos todas las asignaturas que ya han sido ya procesadas
$enrolmentTransitionEntities = EntityManager::getRepository(EnrolmentTransition::class)->findBy(['person' => $personEntity]);
//comprobamos si existe alguna nueva
$newEnrolmentTransitionCollection = $this->getNewEnrollmentCollection($enrollmentCollection, $enrolmentTransitionEntities);
//si hay nuevas matrículas
if ($newEnrolmentTransitionCollection->isNotEmpty())
{
//guardar las nuevas matrículas
$this->storeNewEnrolmentTransitionCollection($personEntity, $newEnrolmentTransitionCollection);
if($newEnrolmentTransitionCollection->pluck('codePO')->unique()->count() == 1)
{
$studentFullName = $newEnrolmentTransitionCollection->pluck('fullName')->first();
$teacherFullName = $newEnrolmentTransitionCollection->pluck('teacherFullName')->first();
$teacherEmail = ($newEnrolmentTransitionCollection->pluck('teacherEmail')->first() == null) ? 'noemail' : $newEnrolmentTransitionCollection->pluck('teacherEmail')->first();
//enviar el correo electrónico con el estado del alumno
$this->sendMail($studentFullName, $teacherFullName, $teacherEmail, $enrollmentCollection);
}
else
{
$codePOCollection = $newEnrolmentTransitionCollection->pluck('codePO')->unique();
foreach ($codePOCollection as $codePO)
{
//busco al profe en la coleccion
$perTeacherEnrolmentTransitionCollection = $enrollmentCollection->filter(function ($value) use ($codePO) {
if($codePO == $value['codePO'])
{
return $value;
}
});
//compongo los parametros
$studentFullName = $perTeacherEnrolmentTransitionCollection->pluck('fullName')->first();
$teacherFullName = $perTeacherEnrolmentTransitionCollection->pluck('teacherFullName')->first();
$teacherEmail = ($perTeacherEnrolmentTransitionCollection->pluck('teacherEmail')->first() == null) ? 'noemail' : $perTeacherEnrolmentTransitionCollection->pluck('teacherEmail')->first();
//envio el correo
$this->sendMail($studentFullName, $teacherFullName, $teacherEmail, $enrollmentCollection);
}
}
}
}
Log::info('+--------------------------------------------------------------------------------------------------------------');
Log::info('|End process');
Log::info('+--------------------------------------------------------------------------------------------------------------');
}
/**
*
* @param string $studentFullName
* @param string $teacherFullName
* @param string $teacherEmail
* @param Collection $enrollmentCollection
*/
private function sendMail($studentFullName, $teacherFullName, $teacherEmail, $enrollmentCollection)
{
$dataPerson = [
'teacherFullName' => $teacherFullName,
'studentFullName' => $studentFullName,
'enrollments' => $enrollmentCollection->all(),
];
if ($this->userHasValidEmail($teacherEmail))
{
Mail::to($teacherEmail, $teacherFullName)->send(new MailSubjects($dataPerson));
Log::notice('EMAIL ENVIADO - ' . $teacherEmail . ' - TEACHER: ' . $dataPerson['teacherFullName'] . ' <---------------');
}
else
{
Log::warning('EMAIL NO ENVIADO - TEACHER: ' . $dataPerson['teacherFullName'] . ' XXXXXXXXX');
}
}
/**
*
* @param Person $personEntity
* @param Collection $newEnrolmentTransitionCollection
*/
private function storeNewEnrolmentTransitionCollection($personEntity, $newEnrolmentTransitionCollection)
{
foreach ($newEnrolmentTransitionCollection as $newEnrolmentTransition)
{
$enrolmentTransitionEntity = new EnrolmentTransition($newEnrolmentTransition['eccanetTraEstMatId']);
$enrolmentTransitionEntity->setPerson($personEntity);
$personEntity->getEccanetTEstMatIds()->add($enrolmentTransitionEntity);
}
EntityManager::persist($personEntity);
EntityManager::flush($personEntity);
}
/**
* Return a collection filtered whit not notificated ones
* @param Collection $enrollmentCollection
* @param array|null $enrolmentTransitionEntities
* @return Collection
*/
private function getNewEnrollmentCollection($enrollmentCollection, $enrolmentTransitionEntities)
{
$collection = collect();
foreach($enrollmentCollection as $enrollemnt)
{
$isNew = false;
foreach($enrolmentTransitionEntities as $enrolmentTransitionEntity)
{
if ($enrollemnt['eccanetTraEstMatId'] == $enrolmentTransitionEntity->getEccanetTEstMatId())
{
$isNew = true;
break;
}
}
if(!$isNew)
{
$collection->push($enrollemnt);
}
}
return $collection;
}
/**
*
* @param string $userEmail
* @return boolean
*/
private function userHasValidEmail($userEmail)
{
$emailConstain = "noemail";
if (str_contains($userEmail, $emailConstain))
{
return false;
}
return true;
}
/**
*
* @param int $intervalDays
* @return Collection
*/
public function getStudentsPerId($intervalDays)
{
$collection = collect();
if (env('DEFAULT_ECCANET_DB') != 'eccanet')
{
DB::connection(env('DEFAULT_ECCANET_DB'))->statement('ALTER SESSION SET current_schema = ECCANET_PRUEBA');
}
$query = 'select
distinct
p.per_id as per_id,
m.fecha_creacion as fecha,
sysdate - ' . $intervalDays . '
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join planificaciones_centros pc on pc.pla_cen_id = dm.pla_cen_pla_cen_id
inner join centros_orientaciones co on co.cen_ori_id = pc.cen_ori_cen_ori_id
inner join personas po on pc.per_per_id = po.per_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join acciones_formativas af on af.acc_for_id = e.acc_for_acc_for_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
inner join (
select
max(tem.t_est_mat_id) as t_est_mat_id,
tem.det_mat_det_mat_id as det_mat_det_mat_id
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and m.fecha_creacion >= sysdate - ' . $intervalDays . '
and m.tip_mat_id = 8
group by
tem.det_mat_det_mat_id
) LAST_TRANS on dm.det_mat_id = LAST_TRANS.det_mat_det_mat_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and tem.est_mat_id = 4
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and m.fecha_creacion >= sysdate - ' . $intervalDays . '
and m.tip_mat_id = 8
order by
per_id';
$entities = DB::connection(env('DEFAULT_ECCANET_DB'))->select($query);
foreach ($entities as $entity)
{
$collection->push($entity);
}
return $collection;
}
/**
*
* @param int $eccanetPerId
* @return Collection
*/
private function getEccanetStudentEnrolmentCollection($eccanetPerId)
{
$eccanetStudentEnrolmentCollection = collect();
if (env('DEFAULT_ECCANET_DB') != 'eccanet')
{
DB::connection(env('DEFAULT_ECCANET_DB'))->statement('ALTER SESSION SET current_schema = ECCANET_PRUEBA');
}
$query = 'select
p.per_id as per_id,
lower(trim(p.identificacion)) as identificacion,
to_char(p.fecha_nacimiento, \'DD/MM/YYYY\') as fecha_nacimiento,
upper(p.nombre) as nombre,
upper(p.apellido_1) as apellido_1,
upper(p.apellido_2) as apellido_2,
upper(p.nombre||\' \'||trim(p.apellido_1||\' \'|| p.apellido_2)) as nombre_completo,
lower(cea.email) as email,
af.acc_for_id as acc_for_id,
af.nombre as accion_formativa,
e.numero_edicion as edicion,
e.edi_id as edi_id,
tem.fecha as fecha_transicion,
co.cen_ori_id as cen_ori_id,
co.nombre as centro_orientacion,
po.per_id as per_id_po,
po.codigo as codigo_po,
trim(po.nombre) as nombre_po,
trim(po.apellido_1) as apellido_1_po,
trim(po.apellido_2) as apellido_2_po,
lower(trim(po.identificacion)) as identificacion_po,
po.nombre||\' \'||trim(po.apellido_1||\' \'|| po.apellido_2) as nombre_compuesto_po,
lower(cep.email) as email_po,
m.tip_mat_id as tip_mat_id,
LAST_TRANS.t_est_mat_id as t_est_mat_id,
LAST_TRANS.det_mat_det_mat_id as det_mat_id
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join planificaciones_centros pc on pc.pla_cen_id = dm.pla_cen_pla_cen_id
inner join centros_orientaciones co on co.cen_ori_id = pc.cen_ori_cen_ori_id
inner join personas po on pc.per_per_id = po.per_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join acciones_formativas af on af.acc_for_id = e.acc_for_acc_for_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
inner join (
select
max(tem.t_est_mat_id) as t_est_mat_id,
tem.det_mat_det_mat_id as det_mat_det_mat_id
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and p.per_id = ' . $eccanetPerId . '
group by
tem.det_mat_det_mat_id
) LAST_TRANS on dm.det_mat_id = LAST_TRANS.det_mat_det_mat_id
left outer join (
select
max(ce.cor_elc_id) as cor_elc_id,
ce.per_per_id as per_per_id
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join correos_electronicos ce on p.per_id = ce.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and p.per_id = ' . $eccanetPerId . '
group by
ce.per_per_id
) LAST_EMAIL_STUDENTS on p.per_id = LAST_EMAIL_STUDENTS.per_per_id
left outer join correos_electronicos cea on LAST_EMAIL_STUDENTS.cor_elc_id = cea.cor_elc_id
left outer join (
select
max(ce.cor_elc_id) as cor_elc_id,
ce.per_per_id as per_per_id
from
matriculas m
inner join personas p on p.per_id = m.per_per_id
inner join detalles_matriculas dm on m.mat_id = dm.mat_mat_id
inner join planificaciones_centros pc on pc.pla_cen_id = dm.pla_cen_pla_cen_id
inner join centros_orientaciones co on co.cen_ori_id = pc.cen_ori_cen_ori_id
inner join personas po on pc.per_per_id = po.per_id
inner join correos_electronicos ce on po.per_id = ce.per_per_id
inner join ediciones e on e.edi_id = dm.edi_edi_id
inner join acciones_formativas af on af.acc_for_id = e.acc_for_acc_for_id
inner join transiciones_estados_matricula tem on dm.det_mat_id = tem.det_mat_det_mat_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and p.per_id = ' . $eccanetPerId . '
and tem.est_mat_id = 4
and ce.email like \'%.%@radioecca.org\'
group by
ce.per_per_id
) LAST_EMAIL_PO on po.per_id = LAST_EMAIL_PO.per_per_id
left outer join correos_electronicos cep on LAST_EMAIL_PO.cor_elc_id = cep.cor_elc_id
where
e.cur_aca_cur_aca_id = (select cur_aca_id from cursos_academicos ca where sysdate between ca.fecha_inicio and ca.fecha_fin)
and (m.tit_tit_prov_id in (137, 138, 139, 140, 141, 142) or m.tit_tit_id in (137, 138, 139, 140, 141, 142))
and p.per_id = ' . $eccanetPerId . '
and tem.est_mat_id = 4
order by
tem.fecha asc';
$rows = DB::connection('eccanet')->select($query);
foreach ($rows as $row)
{
$eccanetStudentEnrolmentCollection->push([
'eccanetPerId' => (int) $row->per_id,
'identification' => $row->identificacion,
'birthdate' => $row->fecha_nacimiento,
'name' => $row->nombre,
'surname1' => $row->apellido_1,
'surname2' => $row->apellido_2,
'fullName' => $row->nombre_completo,
'email' => $row->email,
'eccanetAccForId' => (int) $row->acc_for_id,
'subject' => $row->accion_formativa,
'eccanetTransitionDate' => Carbon::parse($row->fecha_transicion)->toFormattedDateString(),
'edition' => $row->edicion,
'eccanetEdiId' => (int) $row->edi_id,
'eccanetCenOriId' => (int) $row->cen_ori_id,
'orientationCenter' => $row->centro_orientacion,
'eccanetPOPerId' => (int) $row->per_id_po,
'codePO' => (int) $row->codigo_po,
'teacherName' => $row->nombre_po,
'teacherSurname1' => $row->apellido_1_po,
'teacherSurname2' => $row->apellido_2_po,
'teacherFullName' => $row->nombre_compuesto_po,
'teacherIdentification' => $row->identificacion_po,
'teacherEmail' => $row->email_po,
'eccanetTraEstMatId' => (int) $row->t_est_mat_id,
'eccanetDetMatId' => (int) $row->det_mat_id,
]);
}
return $eccanetStudentEnrolmentCollection->sortByDesc('eccanetTraEstMatId');
}
}
...@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel ...@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
// Commands\syncEnrollments::class
]; ];
/** /**
......
<?php
namespace App\Entities;
use Doctrine\ORM\Mapping AS ORM;
use LaravelDoctrine\Extensions\Timestamps\Timestamps;
/**
* @ORM\Entity
* @ORM\Table(name="enrolment_transition")
*/
class EnrolmentTransition
{
use Timestamps;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(name="id", type="integer")
* @var int
*/
private $id;
/**
* @ORM\Column(name="eccanet_t_est_mat_id", type="integer")
*/
private $eccanetTEstMatId;
/**
* @ORM\ManyToOne(targetEntity="Person", inversedBy="eccanetTEstMatIds")
*/
private $person;
/**
* Constructor
* @param int $eccanetTEstMatId
*/
public function __construct($eccanetTEstMatId)
{
$this->eccanetTEstMatId = $eccanetTEstMatId;
}
/**
* @return int
*/
function getId()
{
return $this->id;
}
/**
* @return int
*/
function getEccanetTEstMatId()
{
return $this->eccanetTEstMatId;
}
/**
* @return Person
*/
function getPerson()
{
return $this->person;
}
/**
* @param int $id
*/
function setId($id)
{
$this->id = $id;
}
/**
* @param int $eccanetTEstMatId
*/
function setEccanetTEstMatId($eccanetTEstMatId)
{
$this->eccanetTEstMatId = $eccanetTEstMatId;
}
/**
* @param Person $person
*/
function setPerson(Person $person)
{
$this->person = $person;
}
}
<?php
namespace App\Entities;
use Doctrine\ORM\Mapping AS ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="people")
*/
class Person
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(name="id", type="integer")
* @var int
*/
private $id;
/**
* @ORM\Column(name="eccanet_per_id", type="integer", unique=true)
* @var int
*/
private $eccanetPerId;
/**
* @ORM\OneToMany(targetEntity="EnrolmentTransition", mappedBy="Person", cascade={"persist", "remove"})
* @var ArrayCollection
*/
private $eccanetTEstMatIds;
public function __construct($eccanetPerId)
{
$this->eccanetPerId = $eccanetPerId;
$this->eccanetTEstMatIds = new ArrayCollection();
}
/**
* @return int
*/
function getId()
{
return $this->id;
}
/**
* @return int
*/
function getPersonId()
{
return $this->eccanetPerId;
}
/**
* @return ArrayCollection
*/
function getEccanetTEstMatIds()
{
return $this->eccanetTEstMatIds;
}
/**
* @param int $id
*/
function setId($id)
{
$this->id = $id;
}
/**
* @param int $personId
*/
function setPersonId($personId)
{
$this->eccanetPerId = $personId;
}
/**
* @param ArrayCollection $eccanetTEstMatIds
*/
function setSubjects(ArrayCollection $eccanetTEstMatIds)
{
$this->eccanetTEstMatIds = $eccanetTEstMatIds;
}
}
\ No newline at end of file
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailSubjects extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public $personData;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($personData)
{
$this->personData = $personData;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('emails.mailSubjects');
}
}
...@@ -6,8 +6,15 @@ ...@@ -6,8 +6,15 @@
"type": "project", "type": "project",
"require": { "require": {
"php": ">=5.6.4", "php": ">=5.6.4",
"beberlei/DoctrineExtensions": "^1.0",
"gedmo/doctrine-extensions": "^2.4",
"guzzlehttp/guzzle": "^6.2",
"laravel-doctrine/extensions": "1.0.*",
"laravel-doctrine/orm": "1.3.*",
"laravel/framework": "5.4.*", "laravel/framework": "5.4.*",
"laravel/tinker": "~1.0" "laravel/tinker": "~1.0",
"nesbot/carbon": "~1.2",
"yajra/laravel-oci8": "5.4.*"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -64,7 +64,7 @@ return [ ...@@ -64,7 +64,7 @@ return [
| |
*/ */
'timezone' => 'UTC', 'timezone' => 'Atlantic/Canary',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -176,7 +176,14 @@ return [ ...@@ -176,7 +176,14 @@ return [
// App\Providers\BroadcastServiceProvider::class, // App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
/*
* Custom Service Providers...
*/
LaravelDoctrine\ORM\DoctrineServiceProvider::class,
LaravelDoctrine\Extensions\BeberleiExtensionsServiceProvider::class,
LaravelDoctrine\Extensions\GedmoExtensionsServiceProvider::class,
Yajra\Oci8\Oci8ServiceProvider::class,
], ],
/* /*
...@@ -225,7 +232,11 @@ return [ ...@@ -225,7 +232,11 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class, 'View' => Illuminate\Support\Facades\View::class,
//Custom
'EntityManager' => LaravelDoctrine\ORM\Facades\EntityManager::class,
'Registry' => LaravelDoctrine\ORM\Facades\Registry::class,
'Doctrine' => LaravelDoctrine\ORM\Facades\Doctrine::class,
], ],
]; ];
...@@ -77,7 +77,16 @@ return [ ...@@ -77,7 +77,16 @@ return [
'charset' => 'utf8', 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
], ],
'eccanet' => [
'driver' => env('ECCANET_DB_PRODUCTION_DRIVER'),
'host' => env('ECCANET_DB_PRODUCTION_HOST'),
'port' => env('ECCANET_DB_PRODUCTION_PORT'),
'database' => env('ECCANET_DB_PRODUCTION_DATABASE'),
'username' => env('ECCANET_DB_PRODUCTION_USERNAME'),
'password' => env('ECCANET_DB_PRODUCTION_PASSWORD'),
'charset' => env('ECCANET_DB_PRODUCTION_CHARSET'),
'prefix' => ''
],
], ],
/* /*
......
<?php
return [
/*
|--------------------------------------------------------------------------
| Entity Mangers
|--------------------------------------------------------------------------
|
| Configure your Entity Managers here. You can set a different connection
| and driver per manager and configure events and filters. Change the
| paths setting to the appropriate path and replace App namespace
| by your own namespace.
|
| Available meta drivers: fluent|annotations|yaml|xml|config|static_php|php
|
| Available connections: mysql|oracle|pgsql|sqlite|sqlsrv
| (Connections can be configured in the database config)
|
| --> Warning: Proxy auto generation should only be enabled in dev!
|
*/
'managers' => [
'default' => [
'dev' => env('APP_DEBUG'),
'meta' => env('DOCTRINE_METADATA', 'annotations'),
'connection' => env('DB_CONNECTION', 'mysql'),
'namespaces' => [
'App'
],
'paths' => [
base_path('app/Entities')
],
'repository' => Doctrine\ORM\EntityRepository::class,
'proxies' => [
'namespace' => false,
'path' => storage_path('proxies'),
'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
],
/*
|--------------------------------------------------------------------------
| Doctrine events
|--------------------------------------------------------------------------
|
| The listener array expects the key to be a Doctrine event
| e.g. Doctrine\ORM\Events::onFlush
|
*/
'events' => [
'listeners' => [],
'subscribers' => []
],
'filters' => [],
/*
|--------------------------------------------------------------------------
| Doctrine mapping types
|--------------------------------------------------------------------------
|
| Link a Database Type to a Local Doctrine Type
|
| Using 'enum' => 'string' is the same of:
| $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
| \Doctrine\DBAL\Connection $connection,
| \Doctrine\Common\EventManager $eventManager) {
| $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
| });
|
| References:
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
| http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
| http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
| http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
|--------------------------------------------------------------------------
*/
'mapping_types' => [
//'enum' => 'string'
]
]
],
/*
|--------------------------------------------------------------------------
| Doctrine Extensions
|--------------------------------------------------------------------------
|
| Enable/disable Doctrine Extensions by adding or removing them from the list
|
| If you want to require custom extensions you will have to require
| laravel-doctrine/extensions in your composer.json
|
*/
'extensions' => [
//LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class,
LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class,
//LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class,
//LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class,
//LaravelDoctrine\Extensions\Sortable\SortableExtension::class,
//LaravelDoctrine\Extensions\Tree\TreeExtension::class,
//LaravelDoctrine\Extensions\Loggable\LoggableExtension::class,
//LaravelDoctrine\Extensions\Blameable\BlameableExtension::class,
//LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class,
//LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class
],
/*
|--------------------------------------------------------------------------
| Doctrine custom types
|--------------------------------------------------------------------------
|
| Create a custom or override a Doctrine Type
|--------------------------------------------------------------------------
*/
'custom_types' => [
'json' => LaravelDoctrine\ORM\Types\Json::class
],
/*
|--------------------------------------------------------------------------
| DQL custom datetime functions
|--------------------------------------------------------------------------
*/
'custom_datetime_functions' => [],
/*
|--------------------------------------------------------------------------
| DQL custom numeric functions
|--------------------------------------------------------------------------
*/
'custom_numeric_functions' => [],
/*
|--------------------------------------------------------------------------
| DQL custom string functions
|--------------------------------------------------------------------------
*/
'custom_string_functions' => [],
/*
|--------------------------------------------------------------------------
| Enable query logging with laravel file logging,
| debugbar, clockwork or an own implementation.
| Setting it to false, will disable logging
|
| Available:
| - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger
| - LaravelDoctrine\ORM\Loggers\ClockworkLogger
| - LaravelDoctrine\ORM\Loggers\FileLogger
|--------------------------------------------------------------------------
*/
'logger' => env('DOCTRINE_LOGGER', false),
/*
|--------------------------------------------------------------------------
| Cache
|--------------------------------------------------------------------------
|
| Configure meta-data, query and result caching here.
| Optionally you can enable second level caching.
|
| Available: apc|array|file|memcached|redis|void
|
*/
'cache' => [
'second_level' => false,
'default' => env('DOCTRINE_CACHE', 'array'),
'namespace' => null,
'metadata' => [
'driver' => env('DOCTRINE_METADATA_CACHE', env('DOCTRINE_CACHE', 'array')),
'namespace' => null,
],
'query' => [
'driver' => env('DOCTRINE_QUERY_CACHE', env('DOCTRINE_CACHE', 'array')),
'namespace' => null,
],
'result' => [
'driver' => env('DOCTRINE_RESULT_CACHE', env('DOCTRINE_CACHE', 'array')),
'namespace' => null,
],
],
/*
|--------------------------------------------------------------------------
| Gedmo extensions
|--------------------------------------------------------------------------
|
| Settings for Gedmo extensions
| If you want to use this you will have to require
| laravel-doctrine/extensions in your composer.json
|
*/
'gedmo' => [
'all_mappings' => false
],
/*
|--------------------------------------------------------------------------
| Validation
|--------------------------------------------------------------------------
|
| Enables the Doctrine Presence Verifier for Validation
|
*/
'doctrine_presence_verifier' => true,
/*
|--------------------------------------------------------------------------
| Notifications
|--------------------------------------------------------------------------
|
| Doctrine notifications channel
|
*/
'notifications' => [
'channel' => 'database'
]
];
...@@ -56,8 +56,8 @@ return [ ...@@ -56,8 +56,8 @@ return [
*/ */
'from' => [ 'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'address' => env('MAIL_FROM_ADDRESS', 'admin@radioecca.org'),
'name' => env('MAIL_FROM_NAME', 'Example'), 'name' => env('MAIL_FROM_NAME', 'Administration'),
], ],
/* /*
......
auxiliary.org-netbeans-modules-php-editor.fluent_2e_setter_2e_project_2e_property=false
auxiliary.org-netbeans-modules-php-editor.getter_2e_setter_2e_method_2e_name_2e_generation=AS_JAVA
auxiliary.org-netbeans-modules-php-editor.public_2e_modifier_2e_project_2e_property=false
copy.src.files=false
copy.src.on.open=false
copy.src.target=
run.as=LOCAL
url=http://bachilletaro-cod-emailer-dev.radioecca.org/debug
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/yeray/code/syncEnrollment/resources/views/emails/mailSubjects.blade.php</file>
<file>file:/home/yeray/code/syncEnrollment/app/Entities/EnrolmentTransition.php</file>
<file>file:/home/yeray/code/syncEnrollment/app/Entities/Person.php</file>
<file>file:/home/yeray/code/syncEnrollment/app/Console/Commands/syncEnrollments.php</file>
<file>file:/home/yeray/code/syncEnrollment/composer.json</file>
</group>
</open-files>
</project-private>
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=public
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>laravel</name>
</data>
</configuration>
</project>
@php
$rowclass = '#D8D8D8';
@endphp
<br>
<h4>Hola {{ $personData['teacherFullName'] }}:</h4>
<b>{{ $personData['studentFullName'] }}</b> se ha matriculado en las siguientes asignaturas:<br><br>
<table width='90%'>
<tr bgcolor='#A9D0F5'>
<th>Fecha de matriculacion</th>
<th>Asignatura</th>
<th>Edicion</th>
</tr>
@foreach ($personData['enrollments'] as $key => $enrollment )
@php
($rowclass == '#D8D8D8') ? $rowclass = '#F2F5A9' : $rowclass = '#D8D8D8';
@endphp
<tr bgcolor='{{ $rowclass }}'>
<td width='20%' align='center'>{{$enrollment['eccanetTransitionDate']}} </td>
<td width='60%'>{{$enrollment['subject']}}</td>
<td width='20%' align='center'>{{$enrollment['edition']}}</td>
</tr>
@endforeach
</table>
<br>
Gracias, admin@radioecca.org
\ No newline at end of file
...@@ -14,3 +14,7 @@ ...@@ -14,3 +14,7 @@
Route::get('/', function () { Route::get('/', function () {
return view('welcome'); return view('welcome');
}); });
Route::get('/debug', function () {
Artisan::call('sync:enrollments');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment