Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

Move service logic to kernel #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
*/

return array(
'ensemble_kernel' => array(
'page_service_class' => 'Ensemble\KernelDoctrineOrm\Service\Page',
),

'doctrine' => array(
'driver' => array(
'ensemble_cmf_kernel' => array(
Expand Down
12 changes: 3 additions & 9 deletions config/services.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@
* @link http://ensemble.github.com
*/

use Ensemble\KernelDoctrineOrm\Service;

return array(
'factories' => array(
'Ensemble\KernelDoctrineOrm\Service\Page' => function($sm) {
'Ensemble\Kernel\Mapper\Page' => function ($sm) {
$em = $sm->get('Doctrine\ORM\EntityManager');

$service = new Service\Page;
$service->setEntityManager($em);

return $service;
},
return $em->getRepository('Ensemble\KernelDoctrineOrm\Entity\Page');
}
),
);
79 changes: 66 additions & 13 deletions src/KernelDoctrineOrm/Entity/MetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,43 +95,69 @@ class MetaData implements MetaDataInterface
*/
protected $keywords;

/**
* @return Page
*/
public function getPage()
{
return $this->page;
}

public function setPage($page)
/**
* @param Page $page
*/
public function setPage(Page $page)
{
$this->page = $page;
}

public function getTitle ()
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}

public function setTitle ($title)
/**
* @param $title
* @return MetaData
*/
public function setTitle($title)
{
$this->title = (string) $title;
return $this;
}

public function getShortTitle ()
/**
* @return string
*/
public function getShortTitle()
{
return $this->shortTitle;
}

public function setShortTitle ($shortTitle)
/**
* @param $shortTitle
* @return MetaData
*/
public function setShortTitle($shortTitle)
{
$this->shortTitle = (string) $shortTitle;
return $this;
}

public function hasShortTitle ()
/**
* @return bool
*/
public function hasShortTitle()
{
return !empty($this->shortTitle);
}

/**
* @return string
*/
public function getNavigationTitle()
{
if ($this->hasShortTitle()) {
Expand All @@ -141,22 +167,35 @@ public function getNavigationTitle()
}
}

public function getLongTitle ()
/**
* @return string
*/
public function getLongTitle()
{
return $this->longTitle;
}

public function setLongTitle ($longTitle)
/**
* @param $longTitle
* @return MetaData
*/
public function setLongTitle($longTitle)
{
$this->longTitle = (string) $longTitle;
return $this;
}

public function hasLongTitle ()
/**
* @return bool
*/
public function hasLongTitle()
{
return !empty($this->longTitle);
}

/**
* @return string
*/
public function getDescriptiveTitle()
{
if ($this->hasLongTitle()) {
Expand All @@ -166,23 +205,37 @@ public function getDescriptiveTitle()
}
}

public function getDescription ()
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}

public function setDescription ($description)
/**
* @param $description
* @return MetaData
*/
public function setDescription($description)
{
$this->description = (string) $description;
return $this;
}

public function getKeywords ()
/**
* @return string
*/
public function getKeywords()
{
return $this->keywords;
}

public function setKeywords ($keywords)
/**
* @param $keywords
* @return MetaData
*/
public function setKeywords($keywords)
{
$this->keywords = (string) $keywords;
return $this;
Expand Down
Loading