3. This work is licensed under a Creative Commons
Attribution‐Noncommercial‐Share Alike 3.0
The use of these slides in commercial courses or
trainings is explicitly prohibited
http://creativecommons.org/licenses/by‐nc‐sa/3.0/es/
7. Controladores frontales
frontend_dev.php frontend | desarrollo
index.php frontend | producción
backend_dev.php backend | desarrollo
backend.php backend | producción
21. apps/backend/modules/job/config/generator.yml
config:
fields:
is_activated: { label: Activated?, help: Whether the user
has activated the job, or not }
is_public: { label: Public? }
config:
list:
fields:
is_public: { label: quot;Public? (label for the list)quot; }
51. apps/frontend/modules/job/actions/actions.class.php
class jobActions extends sfActions
{
public function executeShow(sfWebRequest $request)
{
$this‐>job = $this‐>getRoute()‐>getObject();
// obtener las ofertas del historial
$jobs = $this‐>getUser()‐>getAttribute(
'historial',
array()
);
// añadir la oferta al historial
array_unshift($jobs, $this‐>job‐>getId());
// guardar de nuevo el historial
$this‐>getUser()‐>setAttribute('historial', $jobs);
}
// ...
}
52. apps/frontend/modules/job/actions/actions.class.php
class jobActions extends sfActions
{
public function executeShow(sfWebRequest $request)
{
$this‐>job = $this‐>getRoute()‐>getObject();
$this‐>getUser()‐>addJobToHistory($this‐>job);
}
// ...
}
apps/frontend/lib/myUser.class.php
class myUser extends sfBasicSecurityUser
{
public function addJobToHistory(JobeetJob $job)
{
...
}
$sf_user
}
67. test/functional/frontend/jobActionsTest.php
$browser‐>
info('4 ‐ User job history')‐>
loadData()‐>
restart()‐>
info(' 4.1 ‐ When the user access a job, it is added to its history')‐>
get('/')‐>
click('Web Developer', array(), array('position' => 1))‐>
get('/')‐>
with('user')‐>begin()‐>
isAttribute('job_history', array($browser‐>getMostRecentProgrammingJob()‐>getId()))‐>
end()‐>
info(' 4.2 ‐ A job is not added twice in the history')‐>
click('Web Developer', array(), array('position' => 1))‐>
get('/')‐>
with('user')‐>begin()‐>
isAttribute('job_history', array($browser‐>getMostRecentProgrammingJob()‐>getId()))‐>
end()
;