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

syncEnrollment project 1.0

parent 0f0178a5
This diff is collapsed.
...@@ -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 diff is collapsed.
...@@ -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