diff --git a/Admin/BaseAdmin.php b/Admin/BaseAdmin.php index 7a53444d1..b0901d30f 100644 --- a/Admin/BaseAdmin.php +++ b/Admin/BaseAdmin.php @@ -1,5 +1,4 @@ + * Class BaseAdmin + * @package Networking\InitCmsBundle\Admin + * @author Yorkie Chadwick */ abstract class BaseAdmin extends Admin { @@ -65,7 +64,7 @@ protected function getLocaleChoices() $locale = $this->getRequest()->get('locale'); } - if(is_array($locale) && array_key_exists('value', $locale)){ + if (is_array($locale) && array_key_exists('value', $locale)) { $locale = $locale['value']; } @@ -141,7 +140,7 @@ public function getTrackedActions() } /** - * @param ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { @@ -149,7 +148,7 @@ protected function configureListFields(ListMapper $listMapper) } /** - * @param FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { @@ -157,7 +156,7 @@ protected function configureFormFields(FormMapper $formMapper) } /** - * @param ShowMapper $showMapper + * {@inheritdoc} */ protected function configureShowFields(ShowMapper $showMapper) { @@ -165,14 +164,13 @@ protected function configureShowFields(ShowMapper $showMapper) } /** - * @param DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $this->getSonataAnnotationReader()->configureDatagridFilters($this->getClass(), $datagridMapper); } - /** * @return ContainerInterface */ diff --git a/Admin/Document/GalleryAdmin.php b/Admin/Document/GalleryAdmin.php new file mode 100644 index 000000000..59d43ad08 --- /dev/null +++ b/Admin/Document/GalleryAdmin.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + + +namespace Networking\InitCmsBundle\Admin\Document; + +use Networking\InitCmsBundle\Admin\Model\GalleryAdmin as ModelGallery; + +/** + * Class GalleryAdmin + * @package Networking\InitCmsBundle\Admin\Document + * @author Yorkie Chadwick + */ +class GalleryAdmin extends ModelGallery{ + +} + \ No newline at end of file diff --git a/Admin/Document/GroupAdmin.php b/Admin/Document/GroupAdmin.php index 457f82a70..578d0a296 100644 --- a/Admin/Document/GroupAdmin.php +++ b/Admin/Document/GroupAdmin.php @@ -12,7 +12,10 @@ namespace Networking\InitCmsBundle\Admin\Document; use Networking\InitCmsBundle\Admin\Model\GroupAdmin as ModelGroupAdmin; + /** + * Class GroupAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class GroupAdmin extends ModelGroupAdmin { diff --git a/Admin/Document/LayoutBlockAdmin.php b/Admin/Document/LayoutBlockAdmin.php new file mode 100644 index 000000000..26dbbe804 --- /dev/null +++ b/Admin/Document/LayoutBlockAdmin.php @@ -0,0 +1,20 @@ + + */ +class LayoutBlockAdmin extends ModelLayoutBlockAdmin{ + +} \ No newline at end of file diff --git a/Admin/Document/MediaAdmin.php b/Admin/Document/MediaAdmin.php index c21c749c2..a0003cf5e 100644 --- a/Admin/Document/MediaAdmin.php +++ b/Admin/Document/MediaAdmin.php @@ -12,7 +12,10 @@ namespace Networking\InitCmsBundle\Admin\Document; use Networking\InitCmsBundle\Admin\Model\MediaAdmin as ModelMediaAdmin; + /** + * Class MediaAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class MediaAdmin extends ModelMediaAdmin { diff --git a/Admin/Document/MenuItemAdmin.php b/Admin/Document/MenuItemAdmin.php index 325b3a54a..d0421ef95 100644 --- a/Admin/Document/MenuItemAdmin.php +++ b/Admin/Document/MenuItemAdmin.php @@ -11,20 +11,21 @@ namespace Networking\InitCmsBundle\Admin\Document; -use Networking\InitCmsBundle\Admin\BaseAdmin, - Networking\InitCmsBundle\Entity\MenuItem, - Sonata\AdminBundle\Admin\Admin, - Sonata\AdminBundle\Datagrid\ListMapper, - Sonata\AdminBundle\Datagrid\DatagridMapper, - Sonata\AdminBundle\Validator\ErrorElement, - Sonata\AdminBundle\Form\FormMapper, - Sonata\AdminBundle\Route\RouteCollection, - Doctrine\ORM\EntityRepository, - Networking\InitCmsBundle\Form\DataTransformer\MenuItemToNumberTransformer; +use Networking\InitCmsBundle\Admin\BaseAdmin; +use Networking\InitCmsBundle\Entity\MenuItem; +use Sonata\AdminBundle\Datagrid\ListMapper; +use Sonata\AdminBundle\Datagrid\DatagridMapper; +use Sonata\AdminBundle\Validator\ErrorElement; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Route\RouteCollection; +use Doctrine\ORM\EntityRepository; +use Networking\InitCmsBundle\Form\DataTransformer\MenuItemToNumberTransformer; use Sonata\AdminBundle\Exception\ModelManagerException; use Sonata\DoctrineMongoDBAdminBundle\Datagrid\ProxyQuery; /** + * Class MenuItemAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class MenuItemAdmin extends BaseAdmin diff --git a/Admin/Document/PageAdmin.php b/Admin/Document/PageAdmin.php index 88f21e284..9406af594 100644 --- a/Admin/Document/PageAdmin.php +++ b/Admin/Document/PageAdmin.php @@ -12,13 +12,14 @@ namespace Networking\InitCmsBundle\Admin\Document; use Networking\InitCmsBundle\Admin\Model\PageAdmin as ModelPageAdmin; -use Networking\InitCmsBundle\Model\LayoutBlockInterface; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Networking\InitCmsBundle\Model\PageInterface; use Sonata\DoctrineMongoDBAdminBundle\Datagrid\ProxyQuery; /** + * Class PageAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class PageAdmin extends ModelPageAdmin diff --git a/Admin/Document/TagAdmin.php b/Admin/Document/TagAdmin.php new file mode 100644 index 000000000..475dcbee3 --- /dev/null +++ b/Admin/Document/TagAdmin.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Networking\InitCmsBundle\Admin\Document; + +use Networking\InitCmsBundle\Admin\Model\TagAdmin as ModelTagAdmin; + +/** + * Class TagAdmin + * @package Networking\InitCmsBundle\Admin\Document + * @author Yorkie Chadwick + */ +class TagAdmin extends ModelTagAdmin +{ + +} diff --git a/Admin/Document/TranslationAdmin.php b/Admin/Document/TranslationAdmin.php index 6261cde97..4295522df 100644 --- a/Admin/Document/TranslationAdmin.php +++ b/Admin/Document/TranslationAdmin.php @@ -16,11 +16,15 @@ use Sonata\AdminBundle\Datagrid\ListMapper; /** + * Class MongoDBTranslationAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class MongoDBTranslationAdmin extends BaseTranslationAdmin { - + /** + * {@inheritdoc} + */ protected function configureDatagridFilters(DatagridMapper $filter) { $filter diff --git a/Admin/Document/UserAdmin.php b/Admin/Document/UserAdmin.php index a3112617e..ef9d00bf3 100644 --- a/Admin/Document/UserAdmin.php +++ b/Admin/Document/UserAdmin.php @@ -12,6 +12,8 @@ use Networking\InitCmsBundle\Admin\Model\UserAdmin as ModelUserAdmin; /** + * Class UserAdmin + * @package Networking\InitCmsBundle\Admin\Document * @author Yorkie Chadwick */ class UserAdmin extends ModelUserAdmin diff --git a/Admin/Entity/GalleryAdmin.php b/Admin/Entity/GalleryAdmin.php new file mode 100644 index 000000000..6235f95b0 --- /dev/null +++ b/Admin/Entity/GalleryAdmin.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Networking\InitCmsBundle\Admin\Entity; + +use Networking\InitCmsBundle\Admin\Model\GalleryAdmin as ModelGalleryAdmin; + +/** + * Class GalleryAdmin + * @package Networking\InitCmsBundle\Admin\Entity + * @author Yorkie Chadwick + */ +class GalleryAdmin extends ModelGalleryAdmin{ + +} + \ No newline at end of file diff --git a/Admin/Entity/GroupAdmin.php b/Admin/Entity/GroupAdmin.php index 642239d97..c0cb0880d 100644 --- a/Admin/Entity/GroupAdmin.php +++ b/Admin/Entity/GroupAdmin.php @@ -7,15 +7,18 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Admin\Entity; use Networking\InitCmsBundle\Admin\Model\GroupAdmin as ModelGroupAdmin; + /** + * Class GroupAdmin + * @package Networking\InitCmsBundle\Admin\Entity * @author Yorkie Chadwick */ -class GroupAdmin extends ModelGroupAdmin { +class GroupAdmin extends ModelGroupAdmin +{ } \ No newline at end of file diff --git a/Admin/Entity/HelpTextAdmin.php b/Admin/Entity/HelpTextAdmin.php index a765b0718..45277aea9 100644 --- a/Admin/Entity/HelpTextAdmin.php +++ b/Admin/Entity/HelpTextAdmin.php @@ -10,6 +10,11 @@ use Networking\InitCmsBundle\Admin\Model\HelpTextAdmin as ModelHelpTextAdmin; +/** + * Class HelpTextAdmin + * @package Networking\InitCmsBundle\Admin\Entity + * @author Yorkie Chadwick + */ class HelpTextAdmin extends ModelHelpTextAdmin{ } \ No newline at end of file diff --git a/Admin/Entity/LayoutBlockAdmin.php b/Admin/Entity/LayoutBlockAdmin.php index 93da960f9..67665db4e 100644 --- a/Admin/Entity/LayoutBlockAdmin.php +++ b/Admin/Entity/LayoutBlockAdmin.php @@ -1,15 +1,22 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Networking\InitCmsBundle\Admin\Entity; use Networking\InitCmsBundle\Admin\Model\LayoutBlockAdmin as ModelLayoutBlockAdmin; +/** + * Class LayoutBlockAdmin + * @package Networking\InitCmsBundle\Admin\Entity + * @author Yorkie Chadwick + */ class LayoutBlockAdmin extends ModelLayoutBlockAdmin{ } \ No newline at end of file diff --git a/Admin/Entity/MediaAdmin.php b/Admin/Entity/MediaAdmin.php index 5478ad810..2776fff1d 100644 --- a/Admin/Entity/MediaAdmin.php +++ b/Admin/Entity/MediaAdmin.php @@ -12,7 +12,10 @@ namespace Networking\InitCmsBundle\Admin\Entity; use Networking\InitCmsBundle\Admin\Model\MediaAdmin as ModelMediaAdmin; + /** + * Class MediaAdmin + * @package Networking\InitCmsBundle\Admin\Entity * @author Yorkie Chadwick */ class MediaAdmin extends ModelMediaAdmin { diff --git a/Admin/Entity/MenuItemAdmin.php b/Admin/Entity/MenuItemAdmin.php index 0c0890b33..b701bf69b 100644 --- a/Admin/Entity/MenuItemAdmin.php +++ b/Admin/Entity/MenuItemAdmin.php @@ -1,16 +1,22 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Networking\InitCmsBundle\Admin\Entity; - use Networking\InitCmsBundle\Admin\Model\MenuItemAdmin as ModelMenuItemAdmin; +/** + * Class MenuItemAdmin + * @package Networking\InitCmsBundle\Admin\Entity + * @author Yorkie Chadwick + */ class MenuItemAdmin extends ModelMenuItemAdmin{ } \ No newline at end of file diff --git a/Admin/Entity/PageAdmin.php b/Admin/Entity/PageAdmin.php index 43971c636..a434504d5 100644 --- a/Admin/Entity/PageAdmin.php +++ b/Admin/Entity/PageAdmin.php @@ -1,5 +1,4 @@ */ class PageAdmin extends ModelPageAdmin { + /** + * @param LayoutBlock $layoutBlock + * @return \Networking\InitCmsBundle\Model\PageInterface + */ public function getPageByLayoutBlock(LayoutBlock $layoutBlock){ return $layoutBlock->getPage(); diff --git a/Document/PageSnapshotRepository.php b/Admin/Entity/TagAdmin.php similarity index 57% rename from Document/PageSnapshotRepository.php rename to Admin/Entity/TagAdmin.php index e6bbffab4..3228e4bf5 100644 --- a/Document/PageSnapshotRepository.php +++ b/Admin/Entity/TagAdmin.php @@ -7,13 +7,17 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Networking\InitCmsBundle\Document; -use Doctrine\ORM\EntityRepository; +namespace Networking\InitCmsBundle\Admin\Entity; + +use Networking\InitCmsBundle\Admin\Model\TagAdmin as ModelTagAdmin; + /** + * Class TagAdmin + * @package Networking\InitCmsBundle\Admin\Entity * @author Yorkie Chadwick */ -class PageSnapshotRepository extends EntityRepository +class TagAdmin extends ModelTagAdmin { } diff --git a/Admin/Entity/TranslationAdmin.php b/Admin/Entity/TranslationAdmin.php index 8c6147b41..6aa12f425 100644 --- a/Admin/Entity/TranslationAdmin.php +++ b/Admin/Entity/TranslationAdmin.php @@ -17,11 +17,15 @@ use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery; /** + * Class TranslationAdmin + * @package Networking\InitCmsBundle\Admin\Entity * @author Yorkie Chadwick */ class TranslationAdmin extends ORMTranslationAdmin { - + /** + * {@inheritdoc} + */ protected function configureDatagridFilters(DatagridMapper $filter) { $filter @@ -60,8 +64,8 @@ protected function configureListFields(ListMapper $list) } /** - * @param unknown $name - * @return multitype:|NULL + * @param string $name + * @return multitype|NULL */ public function getTemplate($name) { @@ -76,6 +80,9 @@ public function getTemplate($name) return parent::getTemplate($name); } + /** + * @return array + */ public function getDomains() { /** @var ProxyQuery $proxyQuery */ diff --git a/Admin/Entity/UserAdmin.php b/Admin/Entity/UserAdmin.php index 2ded0974a..fb077fa76 100644 --- a/Admin/Entity/UserAdmin.php +++ b/Admin/Entity/UserAdmin.php @@ -12,6 +12,8 @@ use Networking\InitCmsBundle\Admin\Model\UserAdmin as ModelUserAdmin; /** + * Class UserAdmin + * @package Networking\InitCmsBundle\Admin\Entity * @author Yorkie Chadwick */ class UserAdmin extends ModelUserAdmin diff --git a/Admin/GalleryAdmin.php b/Admin/Model/GalleryAdmin.php similarity index 83% rename from Admin/GalleryAdmin.php rename to Admin/Model/GalleryAdmin.php index 9aae71fbe..9d8f04f14 100644 --- a/Admin/GalleryAdmin.php +++ b/Admin/Model/GalleryAdmin.php @@ -7,16 +7,17 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Networking\InitCmsBundle\Admin; -use Sonata\MediaBundle\Admin\GalleryAdmin as SonataGalleryAdmin, - Sonata\AdminBundle\Route\RouteCollection, - Sonata\AdminBundle\Form\FormMapper, - Sonata\MediaBundle\Form\DataTransformer\ProviderDataTransformer, - Sonata\AdminBundle\Datagrid\ListMapper, - Sonata\AdminBundle\Datagrid\DatagridMapper; +namespace Networking\InitCmsBundle\Admin\Model; + +use Sonata\MediaBundle\Admin\GalleryAdmin as SonataGalleryAdmin; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Datagrid\ListMapper; +use Sonata\AdminBundle\Datagrid\DatagridMapper; /** + * Class GalleryAdmin + * @package Networking\InitCmsBundle\Admin\Model * @author Yorkie Chadwick */ class GalleryAdmin extends SonataGalleryAdmin @@ -31,7 +32,7 @@ class GalleryAdmin extends SonataGalleryAdmin /** * @param $trackedActions - * @return BaseAdmin + * @return $this */ public function setTrackedActions($trackedActions) { @@ -68,12 +69,12 @@ protected function configureFormFields(FormMapper $formMapper) } $formats = array(); - foreach((array)$this->pool->getFormatNamesByContext($context) as $name => $options) { + foreach ((array)$this->pool->getFormatNamesByContext($context) as $name => $options) { $formats[$name] = $name; } $contexts = array(); - foreach((array)$this->pool->getContexts() as $contextItem => $format) { + foreach ((array)$this->pool->getContexts() as $contextItem => $format) { $contexts[$contextItem] = $contextItem; } @@ -83,20 +84,23 @@ protected function configureFormFields(FormMapper $formMapper) ->add('name') ->add('defaultFormat', 'choice', array('choices' => $formats)) ->add( - 'galleryHasMedias', - 'sonata_type_collection', - array( - 'cascade_validation' => true, - ), - array( - 'edit' => 'inline', - 'inline' => 'table', - 'sortable' => 'position', - 'link_parameters' => array('context' => $context), - ) - ); + 'galleryHasMedias', + 'sonata_type_collection', + array( + 'cascade_validation' => true, + ), + array( + 'edit' => 'inline', + 'inline' => 'table', + 'sortable' => 'position', + 'link_parameters' => array('context' => $context), + ) + ); } + /** + * {@inheritdoc} + */ protected function configureListFields(ListMapper $listMapper) { $listMapper @@ -189,8 +193,8 @@ public function buildDatagrid($context = '') // ok, try to limit to add parent filter if ($this->isChild() && $this->getParentAssociationMapping() && !$mapper->has( - $this->getParentAssociationMapping() - ) + $this->getParentAssociationMapping() + ) ) { $mapper->add( $this->getParentAssociationMapping(), diff --git a/Admin/Model/GroupAdmin.php b/Admin/Model/GroupAdmin.php index d9b1ac318..77df613fb 100644 --- a/Admin/Model/GroupAdmin.php +++ b/Admin/Model/GroupAdmin.php @@ -9,12 +9,12 @@ */ namespace Networking\InitCmsBundle\Admin\Model; -use Sonata\UserBundle\Admin\Entity\GroupAdmin as SonataGroupAdmin, - Sonata\AdminBundle\Form\FormMapper, - Sonata\AdminBundle\Datagrid\ListMapper, - Sonata\AdminBundle\Datagrid\DatagridMapper; +use Sonata\UserBundle\Admin\Entity\GroupAdmin as SonataGroupAdmin; +use Sonata\AdminBundle\Form\FormMapper; /** + * Class GroupAdmin + * @package Networking\InitCmsBundle\Admin\Model * @author Yorkie Chadwick */ abstract class GroupAdmin extends SonataGroupAdmin @@ -32,7 +32,7 @@ abstract class GroupAdmin extends SonataGroupAdmin /** * @param $trackedActions - * @return BaseAdmin + * @return $this */ public function setTrackedActions($trackedActions) { diff --git a/Admin/Model/HelpTextAdmin.php b/Admin/Model/HelpTextAdmin.php index 27bf1a7a2..b1bb0c210 100644 --- a/Admin/Model/HelpTextAdmin.php +++ b/Admin/Model/HelpTextAdmin.php @@ -15,6 +15,11 @@ use Sonata\AdminBundle\Validator\ErrorElement; use Sonata\AdminBundle\Form\FormMapper; +/** + * Class HelpTextAdmin + * @package Networking\InitCmsBundle\Admin\Model + * @author Yorkie Chadwick + */ abstract class HelpTextAdmin extends BaseAdmin { /** @@ -31,7 +36,7 @@ public function getIcon() } /** - * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { @@ -41,20 +46,20 @@ protected function configureListFields(ListMapper $listMapper) ->addIdentifier('translationKey') ->add('locale') ->add( - '_action', - 'actions', - array( - 'label' => ' ', - 'actions' => array( - 'edit' => array(), - 'delete' => array() + '_action', + 'actions', + array( + 'label' => ' ', + 'actions' => array( + 'edit' => array(), + 'delete' => array() + ) ) - ) - ); + ); } /** - * @param \Sonata\AdminBundle\Form\FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { @@ -68,54 +73,52 @@ protected function configureFormFields(FormMapper $formMapper) $formMapper ->add( - 'locale', - 'choice', - array( - 'choices' => $this->getLocaleChoices(), - 'preferred_choices' => array($locale) + 'locale', + 'choice', + array( + 'choices' => $this->getLocaleChoices(), + 'preferred_choices' => array($locale) + ) ) - ) ->add('translationKey') ->add('title', null, array('required' => true)) ->add( - 'text', - 'textarea', - array( - 'required' => false, - 'attr' => array( - 'class' => 'wysiwyg-editor', + 'text', + 'textarea', + array( + 'required' => false, + 'attr' => array( + 'class' => 'wysiwyg-editor', + ) ) - ) - ); + ); } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper ->add( - 'locale', - 'doctrine_orm_callback', - array( - 'callback' => array( - $this, - 'getByLocale' + 'locale', + 'doctrine_orm_callback', + array( + 'callback' => array( + $this, + 'getByLocale' + ), + 'hidden' => false ), - 'hidden' => false - ), - 'choice', - array( - 'empty_value' => false, - 'choices' => $this->getLocaleChoices(), - 'preferred_choices' => array($this->getDefaultLocale()) - ) + 'choice', + array( + 'empty_value' => false, + 'choices' => $this->getLocaleChoices(), + 'preferred_choices' => array($this->getDefaultLocale()) + ) - ); - // ->add('title', null, array('hidden' => true), null, array()) - //->add('text', null, array(), null, array()); + ); } @@ -141,8 +144,7 @@ public function getByLocale($queryBuilder, $alias, $field, $data) } /** - * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement - * @param mixed $object + * {@inheritdoc} */ public function validate(ErrorElement $errorElement, $object) { diff --git a/Admin/Model/LayoutBlockAdmin.php b/Admin/Model/LayoutBlockAdmin.php index dd425c6fe..eb8663dac 100644 --- a/Admin/Model/LayoutBlockAdmin.php +++ b/Admin/Model/LayoutBlockAdmin.php @@ -1,5 +1,4 @@ + * Class LayoutBlockAdmin + * @package Networking\InitCmsBundle\Admin\Model + * @author Yorkie Chadwick */ abstract class LayoutBlockAdmin extends BaseAdmin { @@ -31,7 +31,7 @@ abstract class LayoutBlockAdmin extends BaseAdmin const CUSTOM_FIELD_PREFIX = 'networking_init_cms_content_'; /** - * @param \Sonata\AdminBundle\Form\FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { @@ -44,47 +44,49 @@ protected function configureFormFields(FormMapper $formMapper) $pageManager = $this->getContainer()->get('networking_init_cms.page_manager'); $transformer = new PageToNumberTransformer($pageManager); $formMapper -// ->add('isActive', 'checkbox', array('required' => false, 'label_render' => false)) - ->add('zone', - 'hidden' - ) - ->add($formMapper->getFormBuilder()->create('page', 'hidden') - ->addModelTransformer($transformer), 'hidden') - ->add('classType', 'hidden') - ->add('sortOrder', 'hidden'); + ->add( + 'zone', + 'hidden' + ) + ->add( + $formMapper->getFormBuilder()->create('page', 'hidden') + ->addModelTransformer($transformer), + 'hidden' + ) + ->add('classType', 'hidden') + ->add('sortOrder', 'hidden'); } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper - ->add('name') - ->add('page'); + ->add('name') + ->add('page'); } /** - * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { $listMapper - ->addIdentifier('name') - ->add('page') - ->add('isActive'); + ->addIdentifier('name') + ->add('page') + ->add('isActive'); } /** - * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement - * @param mixed $object + * {@inheritdoc} */ public function validate(ErrorElement $errorElement, $object) { $errorElement - ->with('name') - ->assertLength(array('max' => 255)) - ->end(); + ->with('name') + ->assertLength(array('max' => 255)) + ->end(); } /** diff --git a/Admin/Model/MediaAdmin.php b/Admin/Model/MediaAdmin.php index 8b5bcc35b..42194a4fd 100644 --- a/Admin/Model/MediaAdmin.php +++ b/Admin/Model/MediaAdmin.php @@ -10,16 +10,18 @@ namespace Networking\InitCmsBundle\Admin\Model; -use Sonata\MediaBundle\Admin\ORM\MediaAdmin as SonataMediaAdmin, - Sonata\AdminBundle\Route\RouteCollection, - Sonata\AdminBundle\Form\FormMapper, - Sonata\MediaBundle\Form\DataTransformer\ProviderDataTransformer, - Sonata\AdminBundle\Datagrid\ListMapper, - Sonata\AdminBundle\Datagrid\DatagridMapper, - Sonata\AdminBundle\Admin\AdminInterface, - Knp\Menu\ItemInterface as MenuItemInterface; +use Sonata\AdminBundle\Route\RouteCollection; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\MediaBundle\Form\DataTransformer\ProviderDataTransformer; +use Sonata\AdminBundle\Datagrid\ListMapper; +use Sonata\AdminBundle\Datagrid\DatagridMapper; +use Sonata\AdminBundle\Admin\AdminInterface; +use Knp\Menu\ItemInterface as MenuItemInterface; use Sonata\MediaBundle\Admin\BaseMediaAdmin as Admin; + /** + * Class MediaAdmin + * @package Networking\InitCmsBundle\Admin\Model * @author Yorkie Chadwick */ abstract class MediaAdmin extends Admin @@ -53,10 +55,9 @@ public function setLanguages(array $languages) } - /** * @param $trackedActions - * @return BaseAdmin + * @return $this */ public function setTrackedActions($trackedActions) { @@ -74,7 +75,15 @@ public function getTrackedActions() } /** - * @param \Sonata\AdminBundle\Route\RouteCollection $collection + * @return string + */ + public function getIcon() + { + return 'icon-picture'; + } + + /** + * {@inheritdoc} */ public function configureRoutes(RouteCollection $collection) { @@ -85,14 +94,6 @@ public function configureRoutes(RouteCollection $collection) $collection->add('uploadedTextBlockFile', 'uploaded_text_block_file', array(), array('method' => 'GET')); } - /** - * @return string - */ - public function getIcon() - { - return 'icon-picture'; - } - /** * {@inheritdoc} */ @@ -122,13 +123,13 @@ protected function configureFormFields(FormMapper $formMapper) } else { $provider->buildCreateForm($formMapper); } - $formMapper->add( - 'locale', - 'choice', - array( - 'choices' => $this->getLocaleChoices(), - ) - ); + $formMapper->add( + 'locale', + 'choice', + array( + 'choices' => $this->getLocaleChoices(), + ) + ); if ($formMapper->has('enabled')) { $formMapper->add( @@ -159,6 +160,9 @@ protected function configureFormFields(FormMapper $formMapper) } } + /** + * {@inheritdoc} + */ protected function configureListFields(ListMapper $listMapper) { $listMapper @@ -181,20 +185,19 @@ protected function configureListFields(ListMapper $listMapper) } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper - * @return void + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper, $context = '') { $datagridMapper ->add('name', 'networking_init_cms_simple_string'); - //->add('tags', null, array('hidden' => true));Hack by Marc + //->add('tags', null, array('hidden' => true));Hack by Marc if ($context) { $datagridMapper->add('context', null, array('hidden' => true)); $persistedParams = $this->getPersistentParameters(); - if(array_key_exists('context', $persistedParams) && $persistedParams['context'] == $context){ + if (array_key_exists('context', $persistedParams) && $persistedParams['context'] == $context) { $datagridMapper->add('providerName', null, array('hidden' => true)); } @@ -258,8 +261,8 @@ public function buildDatagrid($context = '') // ok, try to limit to add parent filter if ($this->isChild() && $this->getParentAssociationMapping() && !$mapper->has( - $this->getParentAssociationMapping() - ) + $this->getParentAssociationMapping() + ) ) { $mapper->add( $this->getParentAssociationMapping(), @@ -337,7 +340,7 @@ protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInte } /** - * @return array + * {@inheritdoc} */ public function getBatchActions() { @@ -349,7 +352,7 @@ public function getBatchActions() } /** - * @return array + * {@inheritdoc} */ public function getExportFormats() { @@ -378,13 +381,16 @@ protected function getLocaleChoices() return $locale; } - - public function generateUrl($name, array $parameters = array(), $absolute = false){ - try{ - if($this->getRequest()->get('pcode')){ - $parameters['pcode'] = $this->getRequest()->get('pcode'); - } - }catch (\Exception $e){ + /** + * {@inheritdoc} + */ + public function generateUrl($name, array $parameters = array(), $absolute = false) + { + try { + if ($this->getRequest()->get('pcode')) { + $parameters['pcode'] = $this->getRequest()->get('pcode'); + } + } catch (\Exception $e) { //do nothing } diff --git a/Admin/Model/MenuItemAdmin.php b/Admin/Model/MenuItemAdmin.php index d2c1eaafd..a53f6901d 100644 --- a/Admin/Model/MenuItemAdmin.php +++ b/Admin/Model/MenuItemAdmin.php @@ -1,5 +1,4 @@ */ abstract class MenuItemAdmin extends BaseAdmin @@ -59,16 +59,21 @@ public function getIcon() /** - * @param \Sonata\AdminBundle\Route\RouteCollection $collection + * {@inheritdoc} */ protected function configureRoutes(RouteCollection $collection) { - $collection->add('createFromPage', 'create_from_page/root_id/{rootId}/page_id/{pageId}', array(), array('_method' => 'GET|POST', 'rootId', 'pageId')); + $collection->add( + 'createFromPage', + 'create_from_page/root_id/{rootId}/page_id/{pageId}', + array(), + array('_method' => 'GET|POST', 'rootId', 'pageId') + ); $collection->add('ajaxController', 'ajax_navigation', array(), array('_method' => 'GET|POST')); } /** - * @param \Sonata\AdminBundle\Form\FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { @@ -78,10 +83,10 @@ protected function configureFormFields(FormMapper $formMapper) $uniqId = $this->getUniqid(); - if($postArray = $this->getRequest()->get($uniqId)){ - if(array_key_exists('locale', $postArray)){ - $locale = $postArray['locale']; - } + if ($postArray = $this->getRequest()->get($uniqId)) { + if (array_key_exists('locale', $postArray)) { + $locale = $postArray['locale']; + } } @@ -95,10 +100,9 @@ protected function configureFormFields(FormMapper $formMapper) if ($rootId = $this->getRequest()->get('root_id')) { $root = $er->find($rootId); - } - elseif($id){ + } elseif ($id) { $root = $er->find($this->getSubject()->getRoot()); - }else { + } else { $root = $er->findOneBy(array('isRoot' => 1, 'locale' => $locale)); } @@ -113,103 +117,127 @@ protected function configureFormFields(FormMapper $formMapper) ->add('name'); - if ($this->isRoot) { $formMapper ->add('description') ->add('isRoot', 'hidden', array('data' => true)); } else { -// $formMapper->add('menu', 'hidden', array('data' => $root->getId())); // start group page_or_url $formMapper - ->with('Target (page or url)', + ->with( + 'Target (page or url)', array( 'collapsed' => false, - 'description' => $this->translator->trans('form.legend_page_or_url', array(), $this->translationDomain) + 'description' => $this->translator->trans( + 'form.legend_page_or_url', + array(), + $this->translationDomain + ) ) ); $formMapper - ->add('page', - 'networking_type_autocomplete', + ->add( + 'page', + 'networking_type_autocomplete', array( 'attr' => array('style' => "width:220px"), 'class' => 'Application\Networking\InitCmsBundle\Entity\Page', 'required' => false, 'property' => 'AdminTitle', 'query_builder' => function (EntityRepository $er) use ($locale) { - $qb = $er->createQueryBuilder('p'); + $qb = $er->createQueryBuilder('p'); - return $qb->where('p.locale = :locale') - ->orderBy('p.path', 'asc') - ->setParameter(':locale', $locale); - }, + return $qb->where('p.locale = :locale') + ->orderBy('p.path', 'asc') + ->setParameter(':locale', $locale); + }, ) - ); - $formMapper->add('redirect_url', 'url', array('required'=>false, 'help_inline' => 'help.redirect_url')); - $formMapper->add('internal_url', 'text', array('required'=>false, 'help_inline' => 'help.internal_url')); + ); + $formMapper->add('redirect_url', 'url', array('required' => false, 'help_inline' => 'help.redirect_url')); + $formMapper->add('internal_url', 'text', array('required' => false, 'help_inline' => 'help.internal_url')); $formMapper->end(); // start group optionals $formMapper - ->with('Options', + ->with( + 'Options', array( 'collapsed' => true, - 'description' => $this->translator->trans('form.legend_options', array(), $this->translationDomain) - )) - ->add( - 'visibility', - 'sonata_type_translatable_choice', - array( - 'help_inline' => 'visibility.helper.text', - 'choices' => MenuItem::getVisibilityList(), - 'catalogue' => $this->translationDomain - ) + 'description' => $this->translator->trans( + 'form.legend_options', + array(), + $this->translationDomain + ) ) - ->add('link_target', 'choice', array('choices'=>$this->getTranslatedLinkTargets(), 'required'=>false)) - ->add('link_class', 'text', array('required'=>false)) - ->add('link_rel', 'text', array('required'=>false)) - ->add('hidden', null, array('required'=>false)) + ) + ->add( + 'visibility', + 'sonata_type_translatable_choice', + array( + 'help_inline' => 'visibility.helper.text', + 'choices' => MenuItem::getVisibilityList(), + 'catalogue' => $this->translationDomain + ) + ) + ->add( + 'link_target', + 'choice', + array('choices' => $this->getTranslatedLinkTargets(), 'required' => false) + ) + ->add('link_class', 'text', array('required' => false)) + ->add('link_rel', 'text', array('required' => false)) + ->add('hidden', null, array('required' => false)) ->end(); $entityManager = $this->getContainer()->get('Doctrine')->getManager(); $transformer = new MenuItemToNumberTransformer($entityManager); - $menuField = $formMapper->getFormBuilder()->create('menu', 'hidden', array('data' => $root, 'data_class' => null)); + $menuField = $formMapper->getFormBuilder()->create( + 'menu', + 'hidden', + array('data' => $root, 'data_class' => null) + ); $menuField->addModelTransformer($transformer); $formMapper - ->add($menuField, 'hidden'); + ->add($menuField, 'hidden'); } } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper - ->add('locale', - 'doctrine_orm_callback', - array('callback' => array($this, 'getByLocale')), - 'choice', - array( - 'empty_value' => false, - 'choices' => $this->getLocaleChoices(), - 'preferred_choices' => array($this->getDefaultLocale()) - )); + ->add( + 'locale', + 'doctrine_orm_callback', + array('callback' => array($this, 'getByLocale')), + 'choice', + array( + 'empty_value' => false, + 'choices' => $this->getLocaleChoices(), + 'preferred_choices' => array($this->getDefaultLocale()) + ) + ); } /** - * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('name') ->add('path') - ->add('page', 'many_to_one', array('template' => 'NetworkingInitCmsBundle:PageAdmin:page_list_field.html.twig')) + ->add( + 'page', + 'many_to_one', + array('template' => 'NetworkingInitCmsBundle:PageAdmin:page_list_field.html.twig') + ) ->add('redirect_url') ->add('link_target') ->add('link_class') @@ -225,8 +253,12 @@ protected function configureListFields(ListMapper $listMapper) * @param $value * @return bool */ - public function getByLocale(\Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery $queryBuilder, $alias, $field, $value) - { + public function getByLocale( + \Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery $queryBuilder, + $alias, + $field, + $value + ) { if (!$locale = $value['value']) { $locale = $this->getDefaultLocale(); } @@ -240,8 +272,7 @@ public function getByLocale(\Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery $ } /** - * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement - * @param mixed $object + * {@inheritdoc} */ public function validate(ErrorElement $errorElement, $object) { @@ -250,11 +281,13 @@ public function validate(ErrorElement $errorElement, $object) ->assertNotBlank() ->end(); - if(!$object->getIsRoot()){ + if (!$object->getIsRoot()) { if (!$object->getRedirectUrl() AND !$object->getPage() AND !$object->getInternalUrl()) { $errorElement ->with('menu_page_or_url_required') - ->addViolation($this->translator->trans('menu.page_or_url.required', array(), $this->translationDomain)) + ->addViolation( + $this->translator->trans('menu.page_or_url.required', array(), $this->translationDomain) + ) ->end(); } @@ -262,7 +295,7 @@ public function validate(ErrorElement $errorElement, $object) } /** - * @param $isRoot + * @param boolean $isRoot */ public function setIsRoot($isRoot) { @@ -270,8 +303,7 @@ public function setIsRoot($isRoot) } /** - * @param string $name - * @return null|string + * {@inheritdoc} */ public function getTemplate($name) { @@ -291,16 +323,20 @@ public function getTemplate($name) public function getTranslatedLinkTargets() { $translatedLinkTargets = array(); - foreach($this->linkTargets as $key => $value) - { + foreach ($this->linkTargets as $key => $value) { $translatedLinkTargets[$key] = $this->translator->trans($value, array(), $this->translationDomain); } + return $translatedLinkTargets; } - public function preRemove($object){ - if($object->hasChildren()){ - throw new ModelManagerException('flash_delete_children_error'); - } - } + /** + * {@inheritdoc} + */ + public function preRemove($object) + { + if ($object->hasChildren()) { + throw new ModelManagerException('flash_delete_children_error'); + } + } } diff --git a/Admin/Model/PageAdmin.php b/Admin/Model/PageAdmin.php index 94bb723fc..983bf5ac5 100644 --- a/Admin/Model/PageAdmin.php +++ b/Admin/Model/PageAdmin.php @@ -1,5 +1,4 @@ */ abstract class PageAdmin extends BaseAdmin { @@ -68,19 +66,16 @@ public function getIcon() return 'icon-file-alt'; } - - /** * @param \Networking\InitCmsBundle\Model\PageManagerInterface $pageManager */ - public function setPageManager(PageManagerInterface$pageManager) + public function setPageManager(PageManagerInterface $pageManager) { $this->pageManager = $pageManager; } - /** - * @param \Sonata\AdminBundle\Route\RouteCollection $collection + * {@inheritdoc} */ protected function configureRoutes(RouteCollection $collection) { @@ -104,6 +99,9 @@ protected function configureRoutes(RouteCollection $collection) ); } + /** + * {@inheritdoc} + */ public function getFormBuilder() { try { @@ -146,11 +144,10 @@ public function getFormBuilder() } /** - * @param \Sonata\AdminBundle\Form\FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { -// $this->setFormTheme(array('NetworkingInitCmsBundle:Form:page_form_admin_fields.html.twig')); /** @var $pageManager PageManagerInterface */ $pageManager = $this->getContainer()->get('networking_init_cms.page_manager'); try { @@ -226,9 +223,9 @@ protected function configureFormFields(FormMapper $formMapper) 'class' => 'Application\\Networking\\InitCmsBundle\\Entity\\Page', 'required' => false, 'query_builder' => $pageManager->getParentPagesQuery( - $this->pageLocale, - $this->getSubject()->getId() - ), + $this->pageLocale, + $this->getSubject()->getId() + ), ) ); } @@ -296,8 +293,7 @@ protected function configureFormFields(FormMapper $formMapper) } /** - * @param string $name - * @return null|string + * {@inheritdoc} */ public function getTemplate($name) { @@ -329,7 +325,7 @@ public function getTemplate($name) } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { @@ -426,7 +422,7 @@ public function getByLocale(ProxyQuery $ProxyQuery, $alias, $field, $data) } /** - * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { @@ -437,7 +433,6 @@ protected function configureListFields(ListMapper $listMapper) 'string', array('template' => 'NetworkingInitCmsBundle:PageAdmin:page_title_list_field.html.twig') ) -// ->add('locale', null, array('sortable' => false)) ->add( 'status', null, @@ -470,9 +465,7 @@ protected function configureListFields(ListMapper $listMapper) } /** - * @param \Knp\Menu\ItemInterface $menu - * @param $action - * @param AdminInterface $childAdmin + * {@inheritdoc} */ protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) { @@ -515,9 +508,9 @@ protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInte $this->trans('Translate %language%', array('%language%' => $language['label'])), array( 'uri' => $admin->generateUrl( - 'translatePage', - array('id' => $id, 'locale' => $language['locale']) - ) + 'translatePage', + array('id' => $id, 'locale' => $language['locale']) + ) ) ); } @@ -631,7 +624,7 @@ protected function getPageTemplateIcons() /** - * @return array + * {@inheritdoc} */ public function getBatchActions() { @@ -657,6 +650,9 @@ public function getBatchActions() return $actions; } + /** + * {@inheritdoc} + */ public function getExportFormats() { return array(); diff --git a/Admin/TagAdmin.php b/Admin/Model/TagAdmin.php similarity index 66% rename from Admin/TagAdmin.php rename to Admin/Model/TagAdmin.php index 0e37baf82..ba339a728 100644 --- a/Admin/TagAdmin.php +++ b/Admin/Model/TagAdmin.php @@ -1,5 +1,4 @@ + */ class TagAdmin extends Admin { /** @@ -28,17 +32,16 @@ public function getIcon() } /** - * @param \Sonata\AdminBundle\Form\FormMapper $formMapper + * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('name'); -// ->add('active', null, array('required' => false)); } /** - * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper + * {@inheritdoc} */ protected function configureDatagridFilters(DatagridMapper $datagridMapper) { @@ -47,28 +50,27 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper) } /** - * @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper + * {@inheritdoc} */ protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('name') ->add( - '_action', - 'actions', - array( - 'label' => ' ', - 'actions' => array( - 'edit' => array(), - 'delete' => array() + '_action', + 'actions', + array( + 'label' => ' ', + 'actions' => array( + 'edit' => array(), + 'delete' => array() + ) ) - ) - ); + ); } /** - * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement - * @param mixed $object + * {@inheritdoc} */ public function validate(ErrorElement $errorElement, $object) { diff --git a/Admin/Model/UserAdmin.php b/Admin/Model/UserAdmin.php index a4b157481..4bb28e2a1 100644 --- a/Admin/Model/UserAdmin.php +++ b/Admin/Model/UserAdmin.php @@ -7,20 +7,22 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Admin\Model; -use Sonata\UserBundle\Admin\Entity\UserAdmin as SonataUserAdmin, - Sonata\AdminBundle\Datagrid\ListMapper, - Sonata\AdminBundle\Datagrid\DatagridMapper, - Sonata\AdminBundle\Form\FormMapper; +use Sonata\UserBundle\Admin\Entity\UserAdmin as SonataUserAdmin; +use Sonata\AdminBundle\Datagrid\ListMapper; +use Sonata\AdminBundle\Datagrid\DatagridMapper; +use Sonata\AdminBundle\Form\FormMapper; /** + * Class UserAdmin + * @package Networking\InitCmsBundle\Admin\Model * @author Yorkie Chadwick */ abstract class UserAdmin extends SonataUserAdmin { - /** * @var string */ @@ -33,7 +35,7 @@ abstract class UserAdmin extends SonataUserAdmin /** * @param $trackedActions - * @return BaseAdmin + * @return $this */ public function setTrackedActions($trackedActions) { @@ -89,9 +91,7 @@ protected function configureListFields(ListMapper $listMapper) 'enabled', null, array('editable' => true) - )// ->add('locked', null, array('editable' => true)) -// ->add('createdAt') - ; + ); if ($this->isGranted('ROLE_ALLOWED_TO_SWITCH')) { $listMapper ->add( @@ -134,60 +134,60 @@ protected function configureFormFields(FormMapper $formMapper) { $formMapper ->with('General') - ->add('username') - ->add('email') - ->add('plainPassword', 'text', array('required' => false)) + ->add('username') + ->add('email') + ->add('plainPassword', 'text', array('required' => false)) ->end() ->with('Groups') - ->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true)) + ->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true)) ->end() ->with('Profile') - ->add('dateOfBirth', 'birthday', array('required' => false)) - ->add('firstname', null, array('required' => false)) - ->add('lastname', null, array('required' => false)) - ->add('website', 'url', array('required' => false)) - ->add('biography', 'text', array('required' => false)) - ->add( - 'gender', - 'sonata_user_gender', - array( - 'required' => false, - 'translation_domain' => $this->getTranslationDomain() - ) + ->add('dateOfBirth', 'birthday', array('required' => false)) + ->add('firstname', null, array('required' => false)) + ->add('lastname', null, array('required' => false)) + ->add('website', 'url', array('required' => false)) + ->add('biography', 'text', array('required' => false)) + ->add( + 'gender', + 'sonata_user_gender', + array( + 'required' => false, + 'translation_domain' => $this->getTranslationDomain() ) - ->add('locale', 'locale', array('required' => false)) - ->add('timezone', 'timezone', array('required' => false)) - ->add('phone', null, array('required' => false)) + ) + ->add('locale', 'locale', array('required' => false)) + ->add('timezone', 'timezone', array('required' => false)) + ->add('phone', null, array('required' => false)) ->end() ->with('Social') - ->add('facebookUid', null, array('required' => false)) - ->add('facebookName', null, array('required' => false)) - ->add('twitterUid', null, array('required' => false)) - ->add('twitterName', null, array('required' => false)) - ->add('gplusUid', null, array('required' => false)) - ->add('gplusName', null, array('required' => false)) + ->add('facebookUid', null, array('required' => false)) + ->add('facebookName', null, array('required' => false)) + ->add('twitterUid', null, array('required' => false)) + ->add('twitterName', null, array('required' => false)) + ->add('gplusUid', null, array('required' => false)) + ->add('gplusName', null, array('required' => false)) ->end(); -// if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { + if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { - $formMapper - ->with('Management') - ->add( - 'realRoles', - 'sonata_security_roles', - array( - 'expanded' => true, - 'multiple' => true, - 'required' => false, - 'label_render' => false, - ) + $formMapper + ->with('Management') + ->add( + 'realRoles', + 'sonata_security_roles', + array( + 'expanded' => true, + 'multiple' => true, + 'required' => false, + 'label_render' => false, ) - ->add('locked', null, array('required' => false), array('inline_block' => true)) - ->add('expired', null, array('required' => false), array('inline_block' => true)) - ->add('enabled', null, array('required' => false), array('inline_block' => true)) - ->add('credentialsExpired', null, array('required' => false), array('inline_block' => true)) - ->end(); -// } + ) + ->add('locked', null, array('required' => false), array('inline_block' => true)) + ->add('expired', null, array('required' => false), array('inline_block' => true)) + ->add('enabled', null, array('required' => false), array('inline_block' => true)) + ->add('credentialsExpired', null, array('required' => false), array('inline_block' => true)) + ->end(); + } $formMapper ->with('Security') diff --git a/Admin/PageAdminHelper.php b/Admin/PageAdminHelper.php index 6585d056d..7c61a5c34 100644 --- a/Admin/PageAdminHelper.php +++ b/Admin/PageAdminHelper.php @@ -1,5 +1,4 @@ + * Class PageAdminHelper + * @package Networking\InitCmsBundle\Admin + * @author Yorkie Chadwick */ class PageAdminHelper extends SonataAdminHelper { @@ -93,9 +94,7 @@ public function appendFormFieldElement(AdminInterface $admin, $subject, $element } /** - * @param object $object - * @param FieldDescriptionInterface $fieldDescription - * @throws \RuntimeException + * {@inheritdoc} */ public function addNewInstance($object, FieldDescriptionInterface $fieldDescription) { @@ -114,8 +113,12 @@ public function addNewInstance($object, FieldDescriptionInterface $fieldDescript $method = rtrim($method, 's'); if (!method_exists($object, $method)) { - throw new \RuntimeException(sprintf('Please add a method %s in the %s class!', $method, get_class($object))); - } + throw new \RuntimeException(sprintf( + 'Please add a method %s in the %s class!', + $method, + get_class($object) + )); + } } $object->$method($instance); diff --git a/Admin/Pool.php b/Admin/Pool.php index 7309d746c..1708cc196 100644 --- a/Admin/Pool.php +++ b/Admin/Pool.php @@ -8,17 +8,23 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Admin; use Sonata\AdminBundle\Admin\Pool as AdminPool; /** + * Class Pool + * @package Networking\InitCmsBundle\Admin * @author Yorkie Chadwick */ class Pool extends AdminPool { - + /** + * Get the groups of admins that will be used to display the + * admin menu on the side + * + * @return array + */ public function getDashboardNavigationGroups(){ $groups = $this->getDashboardGroups(); @@ -33,7 +39,6 @@ public function getDashboardNavigationGroups(){ } } - } return $menuGroups; diff --git a/Block/OnlineUsersBlockService.php b/Block/OnlineUsersBlockService.php index 4bd57ee6b..a4a0f04e7 100644 --- a/Block/OnlineUsersBlockService.php +++ b/Block/OnlineUsersBlockService.php @@ -1,5 +1,5 @@ @@ -7,19 +7,24 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Block; -use Doctrine\Common\Persistence\ObjectManager; use Networking\InitCmsBundle\Model\UserManagerInterface; -use Sonata\BlockBundle\Block\BaseBlockService, - Sonata\BlockBundle\Model\BlockInterface, - Sonata\AdminBundle\Form\FormMapper, - Sonata\AdminBundle\Validator\ErrorElement, - Symfony\Component\HttpFoundation\Response, - Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; +use Sonata\BlockBundle\Block\BaseBlockService; +use Sonata\BlockBundle\Model\BlockInterface; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Validator\ErrorElement; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Sonata\BlockBundle\Block\BlockContextInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +/** + * Class OnlineUsersBlockService + * @package Networking\InitCmsBundle\Block + * @author Yorkie Chadwick + */ class OnlineUsersBlockService extends BaseBlockService { @@ -27,6 +32,7 @@ class OnlineUsersBlockService extends BaseBlockService * @var \Networking\InitCmsBundle\Model\UserManagerInterface */ protected $um; + /** * @param string $name * @param EngineInterface $templating @@ -34,8 +40,6 @@ class OnlineUsersBlockService extends BaseBlockService */ public function __construct($name, EngineInterface $templating, UserManagerInterface $um) { - - $this->name = $name; $this->templating = $templating; $this->um = $um; @@ -46,7 +50,6 @@ public function __construct($name, EngineInterface $templating, UserManagerInter */ public function execute(BlockContextInterface $blockContext, Response $response = null) { - $users = $this->um->getLatestActivity(); return $this->renderResponse( @@ -72,7 +75,7 @@ public function validateBlock(ErrorElement $errorElement, BlockInterface $block) */ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) { - + // TODO: Implement buildEditForm() method. } /** @@ -88,7 +91,8 @@ public function getName() */ public function setDefaultSettings(OptionsResolverInterface $resolver) { - $resolver->setDefaults(array( + $resolver->setDefaults( + array( 'template' => 'NetworkingInitCmsBundle:Block:block_online_users.html.twig' ) ); diff --git a/Block/PagesBlockService.php b/Block/PagesBlockService.php index 1e8781614..a1a783a3a 100644 --- a/Block/PagesBlockService.php +++ b/Block/PagesBlockService.php @@ -1,5 +1,5 @@ @@ -7,18 +7,24 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Block; use Networking\InitCmsBundle\Model\PageManagerInterface; -use Sonata\BlockBundle\Block\BaseBlockService, - Sonata\BlockBundle\Model\BlockInterface, - Sonata\AdminBundle\Form\FormMapper, - Sonata\AdminBundle\Validator\ErrorElement, - Symfony\Component\HttpFoundation\Response, - Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; +use Sonata\BlockBundle\Block\BaseBlockService; +use Sonata\BlockBundle\Model\BlockInterface; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Validator\ErrorElement; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Sonata\BlockBundle\Block\BlockContextInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +/** + * Class PagesBlockService + * @package Networking\InitCmsBundle\Block + * @author Yorkie Chadwick + */ class PagesBlockService extends BaseBlockService { /** diff --git a/Block/TranslatableTextBlockService.php b/Block/TranslatableTextBlockService.php index 6843500db..345a5a444 100644 --- a/Block/TranslatableTextBlockService.php +++ b/Block/TranslatableTextBlockService.php @@ -1,5 +1,5 @@ @@ -7,16 +7,22 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Block; -use Sonata\BlockBundle\Block\BaseBlockService, - Sonata\BlockBundle\Model\BlockInterface, - Sonata\AdminBundle\Form\FormMapper, - Sonata\AdminBundle\Validator\ErrorElement, - Symfony\Component\HttpFoundation\Response; +use Sonata\BlockBundle\Block\BaseBlockService; +use Sonata\BlockBundle\Model\BlockInterface; +use Sonata\AdminBundle\Form\FormMapper; +use Sonata\AdminBundle\Validator\ErrorElement; +use Symfony\Component\HttpFoundation\Response; use Sonata\BlockBundle\Block\BlockContextInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +/** + * Class TranslatableTextBlockService + * @package Networking\InitCmsBundle\Block + * @author Yorkie Chadwick + */ class TranslatableTextBlockService extends BaseBlockService { diff --git a/Builder/ListBuilder.php b/Builder/ListBuilder.php index b00f5a3c8..61d2a6a38 100644 --- a/Builder/ListBuilder.php +++ b/Builder/ListBuilder.php @@ -1,5 +1,4 @@ + */ class ListBuilder extends SonataDoctrineOrmListBuilder { - /** - * @param \Sonata\AdminBundle\Guesser\TypeGuesserInterface $guesser - * @param array $templates + * {@inheritdoc} */ public function __construct(TypeGuesserInterface $guesser, $templates = array()) { @@ -29,9 +30,7 @@ public function __construct(TypeGuesserInterface $guesser, $templates = array()) } /** - * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription - * - * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface + * {@inheritdoc} */ public function buildActionFieldDescription(FieldDescriptionInterface $fieldDescription) { diff --git a/Builder/MongoDBListBuilder.php b/Builder/MongoDBListBuilder.php index 1d2525dda..a5dbcf2b1 100644 --- a/Builder/MongoDBListBuilder.php +++ b/Builder/MongoDBListBuilder.php @@ -1,5 +1,4 @@ + */ class MongoDBListBuilder extends SonataDoctrineMongoDBListBuilder { diff --git a/Command/DataSetupCommand.php b/Command/DataSetupCommand.php index d4bcd6009..f4f04c4a6 100644 --- a/Command/DataSetupCommand.php +++ b/Command/DataSetupCommand.php @@ -1,5 +1,4 @@ + */ class DataSetupCommand extends Command { /** @@ -26,22 +29,18 @@ class DataSetupCommand extends Command protected function configure() { $this->setName('networking:initcms:data-setup') - ->setDescription('create and update db schema and append fixtures') - ->addOption('drop', '', InputOption::VALUE_NONE, 'If set: drop the existing db schema') - ->addOption('no-fixtures', '', InputOption::VALUE_NONE, 'If set: don\'t load fixtures') - ; + ->setDescription('create and update db schema and append fixtures') + ->addOption('drop', '', InputOption::VALUE_NONE, 'If set: drop the existing db schema') + ->addOption('no-fixtures', '', InputOption::VALUE_NONE, 'If set: don\'t load fixtures'); } /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int|null|void + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { - if($input->getOption('drop')) - { + if ($input->getOption('drop')) { $this->dropSchema($output); } @@ -49,11 +48,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->initACL($output); $this->sonataSetupACL($output); - if(! $input->getOption('no-fixtures')){ + if (!$input->getOption('no-fixtures')) { $this->loadFixtures($output); } } + /** + * @param OutputInterface $output + * @return int + */ public function dropSchema(OutputInterface $output) { $command = $this->getApplication()->find('doctrine:schema:drop'); diff --git a/Command/InstallCommand.php b/Command/InstallCommand.php index db5e0eb1e..1e2d335c3 100644 --- a/Command/InstallCommand.php +++ b/Command/InstallCommand.php @@ -1,5 +1,4 @@ + */ class InstallCommand extends Command { /** @@ -26,18 +29,17 @@ class InstallCommand extends Command protected function configure() { $this->setName('networking:initcms:install') - ->setDescription("Install the Networking Init cms: create update schema, load fixtures, create super user, dump assetic resources") - ->addOption('username', '', InputOption::VALUE_REQUIRED, 'username of the to be created super user') - ->addOption('email', '', InputOption::VALUE_REQUIRED, 'the email address of the to be created super user') - ->addOption('password', '', InputOption::VALUE_REQUIRED, 'password of the to be created super user') - ; + ->setDescription( + "Install the Networking Init cms: create update schema, load fixtures, create super user, dump assetic resources" + ) + ->addOption('username', '', InputOption::VALUE_REQUIRED, 'username of the to be created super user') + ->addOption('email', '', InputOption::VALUE_REQUIRED, 'the email address of the to be created super user') + ->addOption('password', '', InputOption::VALUE_REQUIRED, 'password of the to be created super user'); } /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - * @return int|null|void + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -46,9 +48,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->dumpAssetic($output); } + /** + * @param $output + * @return int + */ private function setupData($output) { - $command = $this->getApplication()->find('networking:initcms:data-setup'); + $command = $this->getApplication()->find('networking:initcms:data-setup'); $arguments = array( 'command' => 'networking:initcms:data-setup', @@ -92,13 +98,13 @@ private function createAdminUser(InputInterface $input, OutputInterface $output) $arguments['command'] = 'fos:user:create'; - if($input->getOption('username')){ + if ($input->getOption('username')) { $arguments['username'] = $input->getOption('username'); } - if($input->getOption('email')){ + if ($input->getOption('email')) { $arguments['email'] = $input->getOption('email'); } - if($input->getOption('password')){ + if ($input->getOption('password')) { $arguments['password'] = $input->getOption('password'); } $command = $this->getApplication()->find('fos:user:create'); diff --git a/Component/EventDispatcher/CmsEvent.php b/Component/EventDispatcher/CmsEvent.php index 6dbd885bc..d44050804 100644 --- a/Component/EventDispatcher/CmsEvent.php +++ b/Component/EventDispatcher/CmsEvent.php @@ -12,6 +12,8 @@ use Symfony\Component\EventDispatcher\Event; /** + * Class CmsEvent + * @package Networking\InitCmsBundle\Component\EventDispatcher * @author Yorkie Chadwick */ class CmsEvent extends Event @@ -30,13 +32,16 @@ public function __construct($entity) } /** - * @return + * @return mixed */ public function getEntity() { return $this->entity; } + /** + * @return mixed + */ public function getDocument() { return $this->entity; diff --git a/Component/EventDispatcher/CmsEventDispatcher.php b/Component/EventDispatcher/CmsEventDispatcher.php index 9708f2999..cf748d9b0 100644 --- a/Component/EventDispatcher/CmsEventDispatcher.php +++ b/Component/EventDispatcher/CmsEventDispatcher.php @@ -10,7 +10,10 @@ namespace Networking\InitCmsBundle\Component\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher; + /** + * Class CmsEventDispatcher + * @package Networking\InitCmsBundle\Component\EventDispatcher * @author Yorkie Chadwick */ class CmsEventDispatcher extends EventDispatcher diff --git a/Component/Menu/AdminMenuBuilder.php b/Component/Menu/AdminMenuBuilder.php index 5135f7c8e..4cc9d8529 100644 --- a/Component/Menu/AdminMenuBuilder.php +++ b/Component/Menu/AdminMenuBuilder.php @@ -1,5 +1,4 @@ + * Class AdminMenuBuilder + * @package Networking\InitCmsBundle\Component\Menu + * @author Yorkie Chadwick */ class AdminMenuBuilder extends MenuBuilder { @@ -26,10 +27,17 @@ class AdminMenuBuilder extends MenuBuilder */ protected $adminPool; + /** + * @param $adminPool + */ public function setAdminPool($adminPool){ $this->adminPool = $adminPool; } + /** + * @param Request $request + * @return bool|\Knp\Menu\ItemInterface + */ public function createAdminMenu(Request $request) { // Default to homepage diff --git a/Component/Menu/FrontendMenuBuilder.php b/Component/Menu/FrontendMenuBuilder.php index 10fdea413..0e9b061db 100644 --- a/Component/Menu/FrontendMenuBuilder.php +++ b/Component/Menu/FrontendMenuBuilder.php @@ -1,5 +1,4 @@ + * Class FrontendMenuBuilder + * @package Networking\InitCmsBundle\Component\Menu + * @author Yorkie Chadwick */ class FrontendMenuBuilder extends MenuBuilder { @@ -77,15 +74,6 @@ public function createSubnavMenu(Request $request, $menuName, $classes = 'nav na return $menu; } - - /** - * Creates the login and change language navigation for the right side of the top frontend navigation - * @param \Symfony\Component\HttpFoundation\Request $request - * @param $languages - * @param string $classes - * @return \Knp\Menu\ItemInterface - */ - /** * Creates the login and change language navigation for the right side of the top frontend navigation * @@ -175,6 +163,12 @@ public function createDropdownLangMenu( } } + /** + * @param $menu + * @param array $languages + * @param $currentLanguage + * @param string $route + */ public function createInlineLangMenu( &$menu, array $languages, diff --git a/Component/Menu/MenuBuilder.php b/Component/Menu/MenuBuilder.php index e10f709f4..92fa697d0 100644 --- a/Component/Menu/MenuBuilder.php +++ b/Component/Menu/MenuBuilder.php @@ -1,5 +1,4 @@ + * Class MenuBuilder + * @package Networking\InitCmsBundle\Component\Menu + * @author Yorkie Chadwick */ class MenuBuilder extends AbstractNavbarMenuBuilder { diff --git a/Component/Menu/MenuSubItemFilterIterator.php b/Component/Menu/MenuSubItemFilterIterator.php index e0d0cc45b..3fb654f80 100644 --- a/Component/Menu/MenuSubItemFilterIterator.php +++ b/Component/Menu/MenuSubItemFilterIterator.php @@ -1,5 +1,4 @@ + * Class MenuSubItemFilterIterator + * @package Networking\InitCmsBundle\Component\Menu + * @author Yorkie Chadwick */ class MenuSubItemFilterIterator extends \FilterIterator { /** - * @var + * @var string */ private $currentUri; diff --git a/Component/Routing/AbstractRoute.php b/Component/Routing/AbstractRoute.php index 97a372461..2b14e8f62 100644 --- a/Component/Routing/AbstractRoute.php +++ b/Component/Routing/AbstractRoute.php @@ -1,5 +1,4 @@ + * Class AbstractRoute + * @package Networking\InitCmsBundle\Component\Routing + * @author Yorkie Chadwick */ abstract class AbstractRoute extends SymfonyRoute implements RouteObjectInterface { @@ -43,7 +44,7 @@ public function __construct($content, $pattern, array $defaults = array(), array } /** - * @return Page|object + * @return object */ public function getRouteContent() { diff --git a/Component/Routing/CMSRoute.php b/Component/Routing/CMSRoute.php index 1daec6235..8c52b3902 100644 --- a/Component/Routing/CMSRoute.php +++ b/Component/Routing/CMSRoute.php @@ -1,5 +1,4 @@ + * + * Class CMSRoute + * @package Networking\InitCmsBundle\Component\Routing + * @author Yorkie Chadwick */ class CMSRoute extends AbstractRoute { - public function getContent(){ - } + /** + * Get the content document this route entry stands for. If non-null, + * the ControllerClassMapper uses it to identify a controller and + * the content is passed to the controller. + * + * If there is no specific content for this url (i.e. its an "application" + * page), may return null. + * + * @return object the document or entity this route entry points to + */ + public function getContent() + { + // TODO: Implement getContent() method. + } } diff --git a/Controller/CRUDController.php b/Controller/CRUDController.php index a72ed4e61..af85755d8 100644 --- a/Controller/CRUDController.php +++ b/Controller/CRUDController.php @@ -9,7 +9,6 @@ */ namespace Networking\InitCmsBundle\Controller; - use Symfony\Component\HttpFoundation\Response; use Sonata\AdminBundle\Controller\CRUDController as SonataCRUDController; use Networking\InitCmsBundle\Entity\LastEditedListener as ORMLastEditedListener; diff --git a/Controller/FrontendPageController.php b/Controller/FrontendPageController.php index 0c94c3030..7898ae82c 100644 --- a/Controller/FrontendPageController.php +++ b/Controller/FrontendPageController.php @@ -21,7 +21,6 @@ use Networking\InitCmsBundle\Entity\PageSnapshot; use Networking\InitCmsBundle\Helper\LanguageSwitcherHelper; - /** * Class FrontendPageController * @package Networking\InitCmsBundle\Controller diff --git a/Controller/GalleryAdminController.php b/Controller/GalleryAdminController.php index 7d8b0b19f..1c103d2f6 100644 --- a/Controller/GalleryAdminController.php +++ b/Controller/GalleryAdminController.php @@ -13,7 +13,6 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Sonata\MediaBundle\Controller\GalleryAdminController as SonataGalleryAdminController; - /** * Class GalleryAdminController * @package Networking\InitCmsBundle\Controller diff --git a/Controller/HelpTextController.php b/Controller/HelpTextController.php index 9bdbc23d2..de81bde4a 100644 --- a/Controller/HelpTextController.php +++ b/Controller/HelpTextController.php @@ -12,8 +12,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Security\Core\Exception\AccessDeniedException; /** * Class HelpTextController diff --git a/Controller/InitCmsInstallController.php b/Controller/InitCmsInstallController.php index d4a8c8141..e1e7839b9 100644 --- a/Controller/InitCmsInstallController.php +++ b/Controller/InitCmsInstallController.php @@ -23,7 +23,6 @@ /** * Class InitCmsInstallController * @package Networking\InitCmsBundle\Controller - * * @author Yorkie Chadwick */ class InitCmsInstallController extends Controller @@ -96,9 +95,10 @@ public function installDbAction(Request $request, $complete) { $installFailed = false; try { - /** @var $page Page */ - $user = $this->getDoctrine()->getRepository('NetworkingInitCmsBundle:User')->findAll(); - if (count($user) < 1) { + /** @var \FOS\UserBundle\Doctrine\UserManager $userManager */ + $userManager = $this->get('fos_user.user_manager'); + $users = $userManager->findUsers(); + if (count($users) < 1) { throw new \Exception('Users not loaded'); } diff --git a/Controller/MediaAdminController.php b/Controller/MediaAdminController.php index 3f2d385a2..cb0b981c8 100644 --- a/Controller/MediaAdminController.php +++ b/Controller/MediaAdminController.php @@ -9,51 +9,29 @@ */ namespace Networking\InitCmsBundle\Controller; -use Sonata\AdminBundle\Exception\ModelManagerException, - Sonata\MediaBundle\Controller\MediaAdminController as SonataMediaAdminController, - Symfony\Component\HttpFoundation\Request, - Symfony\Component\HttpFoundation\Response, - Symfony\Component\HttpFoundation\JsonResponse, - Sonata\AdminBundle\Admin\Admin as SontataAdmin, - Sonata\MediaBundle\Admin\ORM\MediaAdmin, - Sonata\MediaBundle\Provider\MediaProviderInterface, - Symfony\Component\HttpFoundation\File\UploadedFile, - Symfony\Component\HttpFoundation\RedirectResponse, - Symfony\Component\HttpKernel\Exception\NotFoundHttpException, - Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Sonata\AdminBundle\Exception\ModelManagerException; +use Sonata\MediaBundle\Controller\MediaAdminController as SonataMediaAdminController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; /** + * Class MediaAdminController + * @package Networking\InitCmsBundle\Controller * @author Yorkie Chadwick */ class MediaAdminController extends SonataMediaAdminController { - - /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * @param string $providerName - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return Response */ public function doFileUpload(Request $request, $providerName = 'sonata.media.provider.image') - { - if ($request->get('CKEditor')) { - return $this->ckeditorUploadAction($request, $providerName); - } - - $file = $request->files->get('file'); - - $result = $this->handelMediaUpload($file, $providerName); - $status = $result['status']; - $params = array( - 'filelink' => $result['url'], - 'error' => $result['message'] - ); - - - return new JsonResponse($params, $status); - } - - public function ckeditorUploadAction(Request $request, $providerName = 'sonata.media.provider.image') { $file = $request->files->get('upload'); @@ -71,10 +49,15 @@ public function ckeditorUploadAction(Request $request, $providerName = 'sonata.m } + /** + * @param UploadedFile $file + * @param $providerName + * @return array + */ public function handelMediaUpload(UploadedFile $file, $providerName) { $url = ''; - + $locale = $this->getRequest()->getLocale(); $session = $this->getRequest()->getSession(); @@ -123,7 +106,10 @@ public function handelMediaUpload(UploadedFile $file, $providerName) $mediaAdmin->createObjectSecurity($media); // Check the $_FILES array and save the file. Assign the correct path to a variable ($url). - $url = $this->generateUrl('sonata_media_download', array('id' => $media->getId())) . '/' . $media->getMetadataValue('filename'); + $url = $this->generateUrl( + 'sonata_media_download', + array('id' => $media->getId()) + ) . '/' . $media->getMetadataValue('filename'); // Usually you will only assign something here if the file could not be uploaded. $message = ''; @@ -149,94 +135,65 @@ public function handelMediaUpload(UploadedFile $file, $providerName) return array('url' => $url, 'message' => $message, 'status' => $status); } - + /** + * @param Request $request + * @return \Symfony\Bundle\FrameworkBundle\Controller\Response + */ public function uploadedTextBlockImageAction(Request $request) { - $status = 200; - - //$mediaRepository = $this->getDoctrine()->getRepository('NetworkingInitCmsBundle:Media'); - - //$media = $mediaRepository->findBy(array('providerName' => 'sonata.media.provider.image')); - $media = $this->admin->getModelManager()->findBy(array('providerName' => 'sonata.media.provider.image')); $provider = $this->get('sonata.media.provider.image'); $array = array(); - if ($request->get('CKEditor')) { - $funcNum = $request->get('CKEditorFuncNum'); - // Optional: instance name (might be used to load a specific configuration file or anything else). - $CKEditor = $request->get('CKEditor'); - // Optional: might be used to provide localized messages. - $langCode = $request->get('langCode'); - - foreach ($media as $image) { - $tags = $image->getTags(); - if ($tags->count() > 0) { - foreach ($tags as $tag) { - $array[$tag->getName()][] = array( - 'reference' => $provider->generatePublicUrl($image, 'reference'), - 'media' => $image, - 'title' => $image->getName(), - 'folder' => $tag->getName(), - ); - } - - } else { - $array['Default'][] = array( - 'reference' => $provider->generatePublicUrl($image, 'reference'), - 'media' => $image, - 'title' => $image->getName(), - 'folder' => 'default', - ); - } - } - - uksort( - $array, - function ($a, $b) { - if ($a == 'Default') { - $a = 0; - } - if ($b == 'Default') { - $b = 100000; - } - - return strtolower($a) > strtolower($b); - } - ); - - - return $this->render( - 'NetworkingInitCmsBundle:MediaAdmin:media_image_browser.html.twig', - array('media' => $array, 'funcNum' => $funcNum) - ); - } + $funcNum = $request->get('CKEditorFuncNum'); + // Optional: instance name (might be used to load a specific configuration file or anything else). + $CKEditor = $request->get('CKEditor'); + // Optional: might be used to provide localized messages. + $langCode = $request->get('langCode'); foreach ($media as $image) { $tags = $image->getTags(); if ($tags->count() > 0) { foreach ($tags as $tag) { - $array[] = array( - 'thumb' => $provider->generatePublicUrl($image, 'default_small'), - 'image' => $provider->generatePublicUrl($image, 'reference'), + $array[$tag->getName()][] = array( + 'reference' => $provider->generatePublicUrl($image, 'reference'), + 'media' => $image, 'title' => $image->getName(), 'folder' => $tag->getName(), ); } } else { - $array[] = array( - 'thumb' => $provider->generatePublicUrl($image, 'default_small'), - 'image' => $provider->generatePublicUrl($image, 'reference'), + $array['Default'][] = array( + 'reference' => $provider->generatePublicUrl($image, 'reference'), + 'media' => $image, 'title' => $image->getName(), 'folder' => 'default', ); } } - return new JsonResponse($array, $status); + uksort( + $array, + function ($a, $b) { + if ($a == 'Default') { + $a = 0; + } + if ($b == 'Default') { + $b = 100000; + } + + return strtolower($a) > strtolower($b); + } + ); + + + return $this->render( + 'NetworkingInitCmsBundle:MediaAdmin:media_image_browser.html.twig', + array('media' => $array, 'funcNum' => $funcNum) + ); } @@ -292,14 +249,15 @@ public function createAction() 'NetworkingInitCmsBundle:MediaAdmin:select_provider.html.twig', array( 'providers' => $this->get('sonata.media.pool')->getProvidersByContext( - $this->get('request')->get('context', $this->get('sonata.media.pool')->getDefaultContext()) - ), + $this->get('request')->get('context', $this->get('sonata.media.pool')->getDefaultContext()) + ), 'base_template' => $this->getBaseTemplate(), 'admin' => $this->admin, 'action' => 'create' ) ); } + return parent::createAction(); } @@ -360,77 +318,55 @@ public function uploadTextBlockImageAction(Request $request) return $this->doFileUpload($request); } + /** + * @param Request $request + * @return \Symfony\Bundle\FrameworkBundle\Controller\Response + */ public function uploadedTextBlockFileAction(Request $request) { - $status = 200; - - //$mediaRepository = $this->getDoctrine()->getRepository('NetworkingInitCmsBundle:Media'); - - //$media = $mediaRepository->findBy(array('providerName' => 'sonata.media.provider.file')); - $media = $this->admin->getModelManager()->findBy(array('providerName' => 'sonata.media.provider.file')); $provider = $this->get('sonata.media.provider.file'); $array = array(); - if ($request->get('CKEditor')) { - $funcNum = $request->get('CKEditorFuncNum'); - // Optional: instance name (might be used to load a specific configuration file or anything else). - $CKEditor = $request->get('CKEditor'); - // Optional: might be used to provide localized messages. - $langCode = $request->get('langCode'); - - foreach ($media as $file) { - $tags = $file->getTags(); - if ($tags->count() > 0) { - foreach ($tags as $tag) { - $array[$tag->getName()][] = array( - 'path' => $this->generateUrl('sonata_media_download', array('id' => $file->getId())) . '/' . $file->getMetadataValue('filename'), - 'content_type' => $file->getContentType(), - 'title' => $file->getName(), - ); - } - - } else { - $array['Default'][] = array( - 'path' => $this->generateUrl('sonata_media_download', array('id' => $file->getId())) . '/' . $file->getMetadataValue('filename'), - 'content_type' => $file->getContentType(), - 'title' => $file->getName(), - ); - } - } - - return $this->render( - 'NetworkingInitCmsBundle:MediaAdmin:media_file_browser.html.twig', - array('media' => $array, 'funcNum' => $funcNum, 'langCode' => $langCode) - ); - } - + $funcNum = $request->get('CKEditorFuncNum'); + // Optional: instance name (might be used to load a specific configuration file or anything else). + $CKEditor = $request->get('CKEditor'); + // Optional: might be used to provide localized messages. + $langCode = $request->get('langCode'); foreach ($media as $file) { $tags = $file->getTags(); if ($tags->count() > 0) { foreach ($tags as $tag) { - $array[] = array( - 'path' => $this->generateUrl('sonata_media_download', array('id' => $file->getId())) . '/' . $file->getMetadataValue('filename'), + $array[$tag->getName()][] = array( + 'path' => $this->generateUrl( + 'sonata_media_download', + array('id' => $file->getId()) + ) . '/' . $file->getMetadataValue('filename'), 'content_type' => $file->getContentType(), 'title' => $file->getName(), - 'folder' => $tag->getName(), ); } } else { - $array[] = array( - 'path' => $this->generateUrl('sonata_media_download', array('id' => $file->getId())) . '/' . $file->getMetadataValue('filename'), + $array['Default'][] = array( + 'path' => $this->generateUrl( + 'sonata_media_download', + array('id' => $file->getId()) + ) . '/' . $file->getMetadataValue('filename'), 'content_type' => $file->getContentType(), 'title' => $file->getName(), - 'folder' => 'default', ); } } - return new JsonResponse($array, $status); + return $this->render( + 'NetworkingInitCmsBundle:MediaAdmin:media_file_browser.html.twig', + array('media' => $array, 'funcNum' => $funcNum, 'langCode' => $langCode) + ); + } @@ -508,27 +444,38 @@ public function listAction() ); } + /** + * @param null $id + * @return \Symfony\Bundle\FrameworkBundle\Controller\Response + * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ public function showAction($id = null) - { - if (false === $this->admin->isGranted('SHOW')) { - throw new AccessDeniedException(); - } + { + if (false === $this->admin->isGranted('SHOW')) { + throw new AccessDeniedException(); + } - $media = $this->admin->getObject($id); + $media = $this->admin->getObject($id); - if (!$media) { - throw new NotFoundHttpException('unable to find the media with the id'); - } + if (!$media) { + throw new NotFoundHttpException('unable to find the media with the id'); + } - return $this->render('NetworkingInitCmsBundle:MediaAdmin:show.html.twig', array( - 'media' => $media, - 'formats' => $this->get('sonata.media.pool')->getFormatNamesByContext($media->getContext()), - 'format' => $this->get('request')->get('format', 'reference'), + return $this->render( + 'NetworkingInitCmsBundle:MediaAdmin:show.html.twig', + array( + 'media' => $media, + 'formats' => $this->get('sonata.media.pool')->getFormatNamesByContext($media->getContext()), + 'format' => $this->get('request')->get('format', 'reference'), 'base_template' => $this->getBaseTemplate(), - 'admin' => $this->admin, - 'security' => $this->get('sonata.media.pool')->getDownloadSecurity($media), - 'action' => 'view', - 'pixlr' => $this->container->has('sonata.media.extra.pixlr') ? $this->container->get('sonata.media.extra.pixlr') : false, - )); - } + 'admin' => $this->admin, + 'security' => $this->get('sonata.media.pool')->getDownloadSecurity($media), + 'action' => 'view', + 'pixlr' => $this->container->has('sonata.media.extra.pixlr') ? $this->container->get( + 'sonata.media.extra.pixlr' + ) : false, + ) + ); + } } diff --git a/Controller/MenuItemAdminController.php b/Controller/MenuItemAdminController.php index 55dcb8e39..eb375c1c8 100644 --- a/Controller/MenuItemAdminController.php +++ b/Controller/MenuItemAdminController.php @@ -1,5 +1,4 @@ + * Class MenuItemAdminController + * @package Networking\InitCmsBundle\Controller + * @author Yorkie Chadwick */ class MenuItemAdminController extends CRUDController { - + /** + * @var string + */ protected $currentMenuLanguage = ''; /** - * return the Response object associated to the list action - * - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException - * - * @return Response + * {@inheritdoc} */ public function listAction($pageId = false, $menuId = false) { @@ -70,7 +66,7 @@ public function listAction($pageId = false, $menuId = false) $menus = array(); - /** @var $menuItemManager MenuItemManager */ + /** @var MenuItemManagerInterface $menuItemManager */ $menuItemManager = $this->get('networking_init_cms.menu_item_manager'); @@ -196,8 +192,7 @@ public function listAction($pageId = false, $menuId = false) } /** - * @return Response - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException + * {@inheritdoc} */ public function createAction() { @@ -212,9 +207,7 @@ public function createAction() } /** - * @param null $id - * @return Response|void - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException + * {@inheritdoc} */ public function editAction($id = null) { @@ -224,15 +217,12 @@ public function editAction($id = null) throw new AccessDeniedException(); } } + return parent::editAction($id); } - /** - * @param mixed $id - * @return RedirectResponse|JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|Response - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * {@inheritdoc} */ public function deleteAction($id) { @@ -331,8 +321,10 @@ public function createFromPageAction(Request $request, $rootId, $pageId) $em->flush(); $this->admin->createObjectSecurity($menuItem); - - return $this->redirect($this->admin->generateUrl('list', array('page_id' => $page->getId(), 'menu_id' => $menuItem->getId()))); + + return $this->redirect( + $this->admin->generateUrl('list', array('page_id' => $page->getId(), 'menu_id' => $menuItem->getId())) + ); } @@ -364,7 +356,7 @@ public function updateNodes() if ($node['parent_id']) { $parent = $this->admin->getObject($node['parent_id']); $menuItem->setParent($parent); - }else{ + } else { ; $menuItem->setParent($menuItem->getParentByLevel(0)); } @@ -375,7 +367,6 @@ public function updateNodes() $this->admin->update($menuItem); } - //$em->flush(); $response = array('status' => 'ok', 'message' => $this->admin->trans('info.menu_sorted')); } catch (\Exception $e) { $response = array('status' => 'error', 'message' => $this->admin->trans('info.menu_sorted_error')); @@ -385,10 +376,7 @@ public function updateNodes() } /** - * @param mixed $data - * @param int $status - * @param array $headers - * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response + * {@inheritdoc} */ public function renderJson($data, $status = 200, $headers = array()) { @@ -436,6 +424,7 @@ public function getCaller() { $trace = debug_backtrace(); $name = $trace[2]['function']; + return empty($name) ? 'global' : $name; } diff --git a/Controller/PageAdminController.php b/Controller/PageAdminController.php index 4986d0729..b980be888 100644 --- a/Controller/PageAdminController.php +++ b/Controller/PageAdminController.php @@ -381,7 +381,7 @@ public function updateLayoutBlockSortAction(Request $request) $sort = ++$key; $blockId = str_replace('layoutBlock_', '', $layoutBlockStr); /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */ - $layoutBlockAdmin = $this->get('networking_init_cms.page.admin.layout_block'); + $layoutBlockAdmin = $this->get('networking_init_cms.admin.layout_block'); @@ -413,7 +413,7 @@ public function updateLayoutBlockSortAction(Request $request) 'message' => $this->admin->trans('message.layout_blocks_sorted', array('zone' => '')) ); - $admin = $this->container->get('networking_init_cms.page.admin.page'); + $admin = $this->container->get('networking_init_cms.admin.page'); $page = $subject = $admin->getModelManager()->find($admin->getClass(), $objectId); if ($page) { @@ -446,7 +446,7 @@ public function deleteLayoutBlockAction(Request $request) $blockId = str_replace('layoutBlock_', '', $layoutBlockStr); /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */ - $layoutBlockAdmin = $this->get('networking_init_cms.page.admin.layout_block'); + $layoutBlockAdmin = $this->get('networking_init_cms.admin.layout_block'); $layoutBlock = $layoutBlockAdmin->getObject($blockId); if ($layoutBlock) { @@ -477,7 +477,7 @@ protected function getLayoutBlockFormWidget( $objectId, $elementId, $uniqId = null, - $code = 'networking_init_cms.page.admin.page', + $code = 'networking_init_cms.admin.page', $doUpdate = false ) { $twig = $this->get('twig'); diff --git a/DependencyInjection/Compiler/OverrideServiceCompilerPass.php b/DependencyInjection/Compiler/OverrideServiceCompilerPass.php index 20708bf2d..885ab5f60 100644 --- a/DependencyInjection/Compiler/OverrideServiceCompilerPass.php +++ b/DependencyInjection/Compiler/OverrideServiceCompilerPass.php @@ -1,11 +1,27 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +/** + * Class OverrideServiceCompilerPass + * @package Networking\InitCmsBundle\DependencyInjection\Compiler + * @author Yorkie Chadwick + */ class OverrideServiceCompilerPass implements CompilerPassInterface { + /** + * @param ContainerBuilder $container + */ public function process(ContainerBuilder $container) { if ($container->hasDefinition('sonata.admin.builder.orm_list')) { diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index ae2800306..f78cec400 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -1,14 +1,21 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; /** - * This is the class that validates and merges configuration from your app/config files - * - * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} + * Class Configuration + * @package Networking\InitCmsBundle\DependencyInjection + * @author Yorkie Chadwick */ class Configuration implements ConfigurationInterface { diff --git a/DependencyInjection/NetworkingInitCmsExtension.php b/DependencyInjection/NetworkingInitCmsExtension.php index f7d7d6845..88bf1a78d 100644 --- a/DependencyInjection/NetworkingInitCmsExtension.php +++ b/DependencyInjection/NetworkingInitCmsExtension.php @@ -45,6 +45,7 @@ public function load(array $configs, ContainerBuilder $container) $config = $this->processConfiguration($configuration, $defaults); $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('blocks.xml'); $loader->load('dynamic_routing.xml'); $loader->load('event_listeners.xml'); $loader->load('forms.xml'); @@ -53,13 +54,10 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('services.xml'); $loader->load('validators.xml'); - - $ymlLoader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); if ('custom' !== $config['db_driver']) { $loader->load(sprintf('doctrine_%s.xml', $config['db_driver'])); $loader->load(sprintf('ext_admin_%s.xml', $config['db_driver'])); - $ymlLoader->load(sprintf('admin_%s.yml', $config['db_driver'])); - $ymlLoader->load(sprintf('blocks_%s.yml', $config['db_driver'])); + $loader->load(sprintf('admin_%s.xml', $config['db_driver'])); } diff --git a/Doctrine/ContentRouteManager.php b/Doctrine/ContentRouteManager.php index 5b927859b..70e0dbc11 100644 --- a/Doctrine/ContentRouteManager.php +++ b/Doctrine/ContentRouteManager.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Doctrine; use Doctrine\Common\Persistence\ObjectManager; @@ -21,6 +20,8 @@ use Networking\InitCmsBundle\Model\ContentRouteInterface; /** + * Class ContentRouteManager + * @package Networking\InitCmsBundle\Doctrine * @author Yorkie Chadwick */ abstract class ContentRouteManager extends BaseContentRouteManager diff --git a/Doctrine/Extensions/Versionable/ResourceVersionInterface.php b/Doctrine/Extensions/Versionable/ResourceVersionInterface.php index 5da0c9fe5..28b77c1ed 100644 --- a/Doctrine/Extensions/Versionable/ResourceVersionInterface.php +++ b/Doctrine/Extensions/Versionable/ResourceVersionInterface.php @@ -10,7 +10,9 @@ namespace Networking\InitCmsBundle\Doctrine\Extensions\Versionable; /** - * @author net working AG + * Class ResourceVersionInterface + * @package Networking\InitCmsBundle\Doctrine\Extensions\Versionable + * @author Yorkie Chadwick */ interface ResourceVersionInterface { diff --git a/Doctrine/Extensions/Versionable/VersionListener.php b/Doctrine/Extensions/Versionable/VersionListener.php index dbb8af988..f9f0ba089 100644 --- a/Doctrine/Extensions/Versionable/VersionListener.php +++ b/Doctrine/Extensions/Versionable/VersionListener.php @@ -9,11 +9,12 @@ */ namespace Networking\InitCmsBundle\Doctrine\Extensions\Versionable; -use Networking\InitCmsBundle\Entity\ResourceVersion, - Doctrine\ORM\Event\LifecycleEventArgs, - Doctrine\ORM\EntityManager; +use Networking\InitCmsBundle\Entity\ResourceVersion; +use Doctrine\ORM\Event\LifecycleEventArgs; /** + * Class VersionListener + * @package Networking\InitCmsBundle\Doctrine\Extensions\Versionable * @author Yorkie Chadwick */ class VersionListener diff --git a/Doctrine/Extensions/Versionable/VersionManager.php b/Doctrine/Extensions/Versionable/VersionManager.php index 9c7e9369a..f38b8a89b 100644 --- a/Doctrine/Extensions/Versionable/VersionManager.php +++ b/Doctrine/Extensions/Versionable/VersionManager.php @@ -7,10 +7,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Doctrine\Extensions\Versionable; use Doctrine\ORM\EntityManager; + /** + * Class VersionManager + * @package Networking\InitCmsBundle\Doctrine\Extensions\Versionable * @author Yorkie Chadwick */ class VersionManager diff --git a/Doctrine/Extensions/Versionable/VersionableInterface.php b/Doctrine/Extensions/Versionable/VersionableInterface.php index ed079bd8a..586837b2c 100644 --- a/Doctrine/Extensions/Versionable/VersionableInterface.php +++ b/Doctrine/Extensions/Versionable/VersionableInterface.php @@ -11,10 +11,9 @@ namespace Networking\InitCmsBundle\Doctrine\Extensions\Versionable; /** - * @author net working AG - */ -/** - * + * Class VersionableInterface + * @package Networking\InitCmsBundle\Doctrine\Extensions\Versionable + * @author Yorkie Chadwick */ interface VersionableInterface { diff --git a/Doctrine/Types/EnumPageStatusType.php b/Doctrine/Types/EnumPageStatusType.php index 66240f209..3d95b7b04 100644 --- a/Doctrine/Types/EnumPageStatusType.php +++ b/Doctrine/Types/EnumPageStatusType.php @@ -10,10 +10,10 @@ */ namespace Networking\InitCmsBundle\Doctrine\Types; -use Networking\InitCmsBundle\Doctrine\Types\EnumType; - /** - * @author net working AG + * Class EnumPageStatusType + * @package Networking\InitCmsBundle\Doctrine\Types + * @author Yorkie Chadwick */ class EnumPageStatusType extends EnumType { diff --git a/Doctrine/Types/EnumPageVisibilityType.php b/Doctrine/Types/EnumPageVisibilityType.php index 86b7e6bb5..5087521f1 100644 --- a/Doctrine/Types/EnumPageVisibilityType.php +++ b/Doctrine/Types/EnumPageVisibilityType.php @@ -10,10 +10,10 @@ */ namespace Networking\InitCmsBundle\Doctrine\Types; -use Networking\InitCmsBundle\Doctrine\Types\EnumType; - /** - * @author net working AG + * Class EnumPageVisibilityType + * @package Networking\InitCmsBundle\Doctrine\Types + * @author Yorkie Chadwick */ class EnumPageVisibilityType extends EnumType { diff --git a/Doctrine/Types/EnumType.php b/Doctrine/Types/EnumType.php index 699a4ea36..857099690 100644 --- a/Doctrine/Types/EnumType.php +++ b/Doctrine/Types/EnumType.php @@ -1,5 +1,4 @@ + * Class EnumType + * @package Networking\InitCmsBundle\Doctrine\Types + * @author Yorkie Chadwick */ abstract class EnumType extends Type { diff --git a/Doctrine/UserManager.php b/Doctrine/UserManager.php index 63c555ade..b34d6d757 100644 --- a/Doctrine/UserManager.php +++ b/Doctrine/UserManager.php @@ -8,14 +8,14 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Doctrine; -use Doctrine\Common\Persistence\ObjectManager; use FOS\UserBundle\Doctrine\UserManager as FOSDoctrineUserManager; use Networking\InitCmsBundle\Model\UserManagerInterface; /** + * Class UserManager + * @package Networking\InitCmsBundle\Doctrine * @author Yorkie Chadwick */ abstract class UserManager extends FOSDoctrineUserManager implements UserManagerInterface diff --git a/Document/BaseLayoutBlock.php b/Document/BaseLayoutBlock.php index 18b9a6447..54dcb674e 100644 --- a/Document/BaseLayoutBlock.php +++ b/Document/BaseLayoutBlock.php @@ -1,5 +1,4 @@ + * Class BaseLayoutBlock + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ abstract class BaseLayoutBlock extends ModelLayoutBlock { /** + * Hook on pre-persist operations */ public function prePersist() { diff --git a/Document/BaseMenuItem.php b/Document/BaseMenuItem.php index c1d8b0d2e..ddadfc3fd 100644 --- a/Document/BaseMenuItem.php +++ b/Document/BaseMenuItem.php @@ -1,5 +1,4 @@ + * Class BaseMenuItem + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ abstract class BaseMenuItem extends ModelMenuItem { /** - * @ORM\PrePersist + * Hook on pre-persist operations */ public function prePersist() { diff --git a/Document/ContentRouteListener.php b/Document/ContentRouteListener.php index 5d600955b..e236ecc9d 100644 --- a/Document/ContentRouteListener.php +++ b/Document/ContentRouteListener.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Document; use Doctrine\Common\EventArgs; @@ -16,6 +15,8 @@ use Networking\InitCmsBundle\Model\ContentRouteListener as ModelContentRouteListener; /** + * Class ContentRouteListener + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick */ class ContentRouteListener extends ModelContentRouteListener diff --git a/Document/ContentRouteManager.php b/Document/ContentRouteManager.php index 861568b6d..1ff148f3f 100644 --- a/Document/ContentRouteManager.php +++ b/Document/ContentRouteManager.php @@ -13,8 +13,11 @@ use Doctrine\ODM\MongoDB\DocumentManager; use Networking\InitCmsBundle\Doctrine\ContentRouteManager as DoctrineContentRouteManager; use Symfony\Component\HttpFoundation\Session\Session; + /** - * @author net working AG + * Class ContentRouteManager + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class ContentRouteManager extends DoctrineContentRouteManager { @@ -23,6 +26,4 @@ public function __construct(DocumentManager $dm, $class, Session $session) { parent::__construct($dm, $class, $session); } - - } diff --git a/Document/DocumentChangedListener.php b/Document/DocumentChangedListener.php index 93d41ce90..e5538074f 100644 --- a/Document/DocumentChangedListener.php +++ b/Document/DocumentChangedListener.php @@ -1,10 +1,23 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\Document; use Doctrine\Common\EventArgs; use Networking\InitCmsBundle\Model\ModelChangedListener; +/** + * Class DocumentChangedListener + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick + */ class DocumentChangedListener extends ModelChangedListener { diff --git a/Document/Gallery.php b/Document/Gallery.php index b26888436..c9967b2fd 100644 --- a/Document/Gallery.php +++ b/Document/Gallery.php @@ -1,5 +1,4 @@ - * + * Class Gallery + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class Gallery extends BaseGallery { diff --git a/Document/GalleryHasMedia.php b/Document/GalleryHasMedia.php index a5591fdcd..f6bf91f29 100644 --- a/Document/GalleryHasMedia.php +++ b/Document/GalleryHasMedia.php @@ -1,5 +1,4 @@ - * */ class GalleryHasMedia extends BaseGalleryHasMedia { /** * @var integer $id - * - * */ protected $id; diff --git a/Document/GalleryView.php b/Document/GalleryView.php index ea170ddc6..b826c7c3f 100644 --- a/Document/GalleryView.php +++ b/Document/GalleryView.php @@ -1,15 +1,27 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\Document; use Networking\InitCmsBundle\Model\GalleryView as ModelGalleryView; + /** - * Networking\GalleryBundle\Entity\GalleryView + * Class GalleryView + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class GalleryView extends ModelGalleryView { /** + * Hook on pre-persist operations */ public function prePersist() { diff --git a/Document/Group.php b/Document/Group.php index dc9019e64..571dc11a0 100644 --- a/Document/Group.php +++ b/Document/Group.php @@ -10,27 +10,18 @@ namespace Networking\InitCmsBundle\Document; -use Doctrine\ORM\Mapping as ORM, - Sonata\UserBundle\Entity\BaseGroup as BaseGroup; +use Sonata\UserBundle\Entity\BaseGroup as BaseGroup; /** + * Class Group + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick - * - * Networking\InitCmsBundle\Entity\Group - * - * @ORM\Table(name="fos_user_group") - * @ORM\Entity() */ class Group extends BaseGroup { /** * @var integer $id - * - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - * */ protected $id; diff --git a/Document/HelpText.php b/Document/HelpText.php index 84aaa1479..3445ca346 100644 --- a/Document/HelpText.php +++ b/Document/HelpText.php @@ -13,7 +13,9 @@ use Networking\InitCmsBundle\Model\HelpText as ModelHelpText; /** - * HelpText + * Class HelpText + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class HelpText extends ModelHelpText { diff --git a/Document/HelpTextRepository.php b/Document/HelpTextManager.php similarity index 80% rename from Document/HelpTextRepository.php rename to Document/HelpTextManager.php index d6d077334..eadc2abd2 100644 --- a/Document/HelpTextRepository.php +++ b/Document/HelpTextManager.php @@ -10,15 +10,15 @@ namespace Networking\InitCmsBundle\Document; -use Doctrine\ORM\EntityRepository; +use Doctrine\ODM\MongoDB\DocumentRepository; +use Networking\InitCmsBundle\Model\HelpTextManagerInterface; /** - * HelpTextRepository - * - * This class was generated by the Doctrine ORM. Add your own custom - * repository methods below. + * Class HelpTextRepository + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ -class HelpTextRepository extends EntityRepository +class HelpTextManager extends EntityRepository implements HelpTextManagerInterface { /** * @param $translationKey diff --git a/Document/LastEditedListener.php b/Document/LastEditedListener.php index e63af2e89..f88629eaf 100644 --- a/Document/LastEditedListener.php +++ b/Document/LastEditedListener.php @@ -1,5 +1,4 @@ + * Class LastEditedListener + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class LastEditedListener extends ModelLastEditedListener { - /** * On Menu Create * diff --git a/Document/LayoutBlockFormListener.php b/Document/LayoutBlockFormListener.php index c0005fed5..1447d6f74 100644 --- a/Document/LayoutBlockFormListener.php +++ b/Document/LayoutBlockFormListener.php @@ -1,5 +1,4 @@ + * Class LayoutBlockFormListener + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class LayoutBlockFormListener extends ModelLayoutBlockFormListener { diff --git a/Document/LayoutBlockRepository.php b/Document/LayoutBlockRepository.php deleted file mode 100644 index ccbd3ff3e..000000000 --- a/Document/LayoutBlockRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Document; - -use Doctrine\ORM\EntityRepository; - -/** - * ContentRepository - * - * @author net working AG - */ -class LayoutBlockRepository extends EntityRepository -{ -} diff --git a/Document/Media.php b/Document/Media.php index dacd7ceeb..14e2e3c50 100644 --- a/Document/Media.php +++ b/Document/Media.php @@ -10,16 +10,13 @@ namespace Networking\InitCmsBundle\Document; - use Sonata\MediaBundle\Document\BaseMedia; -use Networking\InitCmsBundle\Document\Tag; use Doctrine\Common\Collections\ArrayCollection; /** + * Class Media + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick - * - * Networking\InitCmsBundle\Document\Media - * */ class Media extends BaseMedia { @@ -44,7 +41,9 @@ class Media extends BaseMedia */ protected $galleryHasMedias; - + /** + * + */ public function __construct() { $this->tags = new ArrayCollection(); diff --git a/Document/MenuItemManager.php b/Document/MenuItemManager.php index 7eff6d40a..b37ab6046 100644 --- a/Document/MenuItemManager.php +++ b/Document/MenuItemManager.php @@ -8,20 +8,26 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Document; use Doctrine\ODM\MongoDB\DocumentManager; - /** + * Class MenuItemManager + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick */ class MenuItemManager { - + /** + * @var \Doctrine\ODM\MongoDB\DocumentManager + */ protected $dm; + /** + * @param DocumentManager $dm + * @param $class + */ public function __construct(DocumentManager $dm, $class) { parent::__construct($dm, $class); diff --git a/Document/PageListener.php b/Document/PageListener.php index 3f5433098..b4bc34bfc 100644 --- a/Document/PageListener.php +++ b/Document/PageListener.php @@ -1,5 +1,4 @@ + * Class PageListener + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class PageListener extends ModelPageListener { diff --git a/Document/PageManager.php b/Document/PageManager.php index 645d9b358..925b19481 100644 --- a/Document/PageManager.php +++ b/Document/PageManager.php @@ -1,4 +1,12 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\Document; @@ -10,11 +18,8 @@ use Networking\InitCmsBundle\Model\PageManagerInterface; /** - * PageRepository - * - * @author net working AG - */ -/** + * Class PageManager + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick */ class PageManager extends MaterializedPathRepository implements PageManagerInterface @@ -26,7 +31,10 @@ class PageManager extends MaterializedPathRepository implements PageManagerInter */ private $container; - + /** + * @param DocumentManager $om + * @param \Doctrine\ODM\MongoDB\UnitOfWork $class + */ public function __construct(DocumentManager $om, $class) { @@ -182,10 +190,10 @@ public function save(PageInterface $page) } /** - * @param LayoutBlock $layoutBlock + * @param BaseLayoutBlock $layoutBlock * @return mixed */ - public function findByLayoutBlock(LayoutBlock $layoutBlock) + public function findByLayoutBlock(BaseLayoutBlock $layoutBlock) { $id = $layoutBlock->getId(); diff --git a/Document/ResourceVersion.php b/Document/ResourceVersion.php index 245bf758a..c7e64abbf 100644 --- a/Document/ResourceVersion.php +++ b/Document/ResourceVersion.php @@ -10,10 +10,11 @@ namespace Networking\InitCmsBundle\Document; use Networking\InitCmsBundle\Model\ResourceVersion as ModelResourceVersion; + /** + * Class ResourceVersion + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick - * - * @ORM\Entity */ class ResourceVersion extends ModelResourceVersion { diff --git a/Document/Tag.php b/Document/Tag.php index b2de95d1b..a9128feaa 100644 --- a/Document/Tag.php +++ b/Document/Tag.php @@ -1,5 +1,4 @@ + * Class Tag + * @package Networking\InitCmsBundle\Document + * @author Yorkie Chadwick */ class Tag extends ModelTag { diff --git a/Document/TagRepository.php b/Document/TagRepository.php deleted file mode 100644 index 5c7c66512..000000000 --- a/Document/TagRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Document; - -use Doctrine\ORM\EntityRepository; - -/** - * TagRepository - * - * @author net working AG - */ -class TagRepository extends EntityRepository -{ -} diff --git a/Document/Text.php b/Document/Text.php index a49cb5146..972bad2b3 100644 --- a/Document/Text.php +++ b/Document/Text.php @@ -8,11 +8,11 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Document; - /** + * Class Text + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick */ class Text extends BaseText{ diff --git a/Document/TextRepository.php b/Document/TextRepository.php deleted file mode 100644 index 9a8a7893b..000000000 --- a/Document/TextRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Document; - -use Doctrine\ORM\EntityRepository; - -/** - * ContentRepository - * - * @author net working AG - */ -class TextRepository extends EntityRepository -{ -} diff --git a/Document/UserManager.php b/Document/UserManager.php index 96cbddc2f..65823e989 100644 --- a/Document/UserManager.php +++ b/Document/UserManager.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Document; use Doctrine\ODM\MongoDB\DocumentManager; @@ -18,10 +17,15 @@ use Doctrine\ODM\MongoDB\DocumentRepository; /** + * Class UserManager + * @package Networking\InitCmsBundle\Document * @author Yorkie Chadwick */ class UserManager extends DoctrineUserManager { + /** + * @var \Doctrine\ODM\MongoDB\DocumentManager + */ protected $dm; /** @@ -29,6 +33,13 @@ class UserManager extends DoctrineUserManager */ protected $repository; + /** + * @param EncoderFactoryInterface $encoderFactory + * @param CanonicalizerInterface $usernameCanonicalizer + * @param CanonicalizerInterface $emailCanonicalizer + * @param DocumentManager $dm + * @param string $class + */ public function __construct( EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, @@ -41,6 +52,9 @@ public function __construct( $this->dm = $dm; } + /** + * @return mixed + */ public function getLatestActivity() { $tenMinutesAgo = new \DateTime('10 hours ago'); diff --git a/Document/UserRepository.php b/Document/UserRepository.php deleted file mode 100644 index 3ab6d7482..000000000 --- a/Document/UserRepository.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Document; - -use Doctrine\ORM\EntityRepository; - -/** - * ContentRepository - * - * @author net working AG - */ -class UserRepository extends EntityRepository -{ - public function getLatestActivity() - { - $tenMinutesAgo = new \DateTime('- 10 minutes'); - $qb = $this->createQueryBuilder('u'); - $qb->where('u.updatedAt >= :datetime') - ->setParameter(':datetime', $tenMinutesAgo ); - - return $qb->getQuery()->getResult(); - } -} diff --git a/Entity/BaseText.php b/Entity/BaseText.php index 60e525bfb..b67aed101 100644 --- a/Entity/BaseText.php +++ b/Entity/BaseText.php @@ -1,5 +1,4 @@ + * Class BaseText + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ abstract class BaseText extends ModelText { /** - * PrePersist method + * Hook on pre-persist operations */ public function prePersist() { @@ -31,7 +30,7 @@ public function prePersist() } /** - * PostPersist method + * Hook on pre-update operations */ public function preUpdate() { diff --git a/Entity/HelpTextManager.php b/Entity/HelpTextManager.php index b1bbbb45b..57c614c1b 100644 --- a/Entity/HelpTextManager.php +++ b/Entity/HelpTextManager.php @@ -15,10 +15,9 @@ use Doctrine\ORM\EntityManager; /** - * HelpTextRepository - * - * This class was generated by the Doctrine ORM. Add your own custom - * repository methods below. + * Class HelpTextManager + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class HelpTextManager extends EntityRepository implements HelpTextManagerInterface { @@ -36,13 +35,13 @@ public function __construct(EntityManager $em, $class) * @param $locale * @return object */ - public function getHelpTextByKeyLocale($translationKey, $locale ) + public function getHelpTextByKeyLocale($translationKey, $locale) { $helpText = $this->findOneBy(array('translationKey' => $translationKey, 'locale' => $locale)); - if($helpText === NULL) - { + if ($helpText === null) { $helpText = $this->findOneBy(array('translationKey' => 'not_found', 'locale' => $locale)); } + return $helpText; } @@ -51,14 +50,14 @@ public function getHelpTextByKeyLocale($translationKey, $locale ) * @param $locale * @return array */ - public function searchHelpTextByKeyLocale($translationKey, $locale ) + public function searchHelpTextByKeyLocale($translationKey, $locale) { $qb = $this->createQueryBuilder('h'); $qb->where('h.locale = :locale') ->andWhere('h.translationKey LIKE :translationKey') ->orderBy('h.id', 'asc') ->setParameter(':locale', $locale) - ->setParameter(':translationKey', $translationKey."%"); + ->setParameter(':translationKey', $translationKey . "%"); return $qb->getQuery()->getResult(); } diff --git a/Entity/LastEditedListener.php b/Entity/LastEditedListener.php index 38d534334..b5f8f6782 100644 --- a/Entity/LastEditedListener.php +++ b/Entity/LastEditedListener.php @@ -1,5 +1,4 @@ + * Class LastEditedListener + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class LastEditedListener extends ModelLastEditedListener { diff --git a/Entity/LayoutBlock.php b/Entity/LayoutBlock.php index f8d98eda5..77c146524 100644 --- a/Entity/LayoutBlock.php +++ b/Entity/LayoutBlock.php @@ -1,5 +1,4 @@ + * Class LayoutBlock + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class LayoutBlock extends ModelLayoutBlock { /** + * Hook on pre-persist operations */ public function prePersist() { diff --git a/Entity/LayoutBlockFormListener.php b/Entity/LayoutBlockFormListener.php index fb7bf6bf1..21a58d33b 100644 --- a/Entity/LayoutBlockFormListener.php +++ b/Entity/LayoutBlockFormListener.php @@ -11,25 +11,15 @@ namespace Networking\InitCmsBundle\Entity; -use Doctrine\Bundle\DoctrineBundle\Registry, - Doctrine\ORM\EntityManager, - Symfony\Component\Form\FormFactoryInterface, - Symfony\Component\EventDispatcher\EventSubscriberInterface, - Symfony\Component\Form\FormEvents, - Symfony\Component\Form\FormEvent, - Symfony\Component\Form\FormBuilder, - Symfony\Component\Form\FormInterface, - Networking\InitCmsBundle\Model\PageInterface, - Networking\InitCmsBundle\Model\LayoutBlockInterface, - Networking\InitCmsBundle\Admin\LayoutBlockAdmin, - Networking\InitCmsBundle\Model\ContentInterface, - Networking\InitCmsBundle\Form\DataTransformer\PageToNumberTransformer, - Networking\InitCmsBundle\Helper\ContentInterfaceHelper, - Ibrows\Bundle\SonataAdminAnnotationBundle\Reader\SonataAdminAnnotationReader; +use Symfony\Component\Form\FormEvent; +use Networking\InitCmsBundle\Model\LayoutBlockInterface; +use Networking\InitCmsBundle\Model\ContentInterface; use Networking\InitCmsBundle\Model\LayoutBlockFormListener as ModelLayoutBlockFormListener; /** - * @author net working AG + * Class LayoutBlockFormListener + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class LayoutBlockFormListener extends ModelLayoutBlockFormListener { diff --git a/Entity/LayoutBlockListener.php b/Entity/LayoutBlockListener.php index c986e6d0c..5a4edece9 100644 --- a/Entity/LayoutBlockListener.php +++ b/Entity/LayoutBlockListener.php @@ -7,15 +7,17 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Entity; -use Doctrine\ORM\EntityNotFoundException, - Doctrine\ORM\Event\LifecycleEventArgs, - JMS\Serializer\Serializer, - Networking\InitCmsBundle\Entity\BasePage as Page, - Networking\InitCmsBundle\Entity\LayoutBlock; +use Doctrine\ORM\EntityNotFoundException; +use Doctrine\ORM\Event\LifecycleEventArgs; +use JMS\Serializer\Serializer; +use Networking\InitCmsBundle\Entity\BasePage as Page; /** + * Class LayoutBlockListener + * @package Networking\InitCmsBundle\Entity * @author Yorkie Chadwick */ class LayoutBlockListener @@ -103,17 +105,6 @@ public function preRemove(LifecycleEventArgs $args) $this->autoPageDraft($args); } } - -// if ($entity instanceof Gallery) { -// -// $repo = $em->getRepository('NetworkingInitCmsBundle:GalleryView'); -// $galleryViews = $repo->findBy(array('mediaGallery' => $entity->getId())); -// -// foreach ($galleryViews as $galleryView) { -// $layoutBlock = $galleryView->getLayoutBlock(); -// $em->remove($layoutBlock); -// } -// } } /** diff --git a/Entity/LayoutBlockRepository.php b/Entity/LayoutBlockRepository.php deleted file mode 100644 index 6409fc397..000000000 --- a/Entity/LayoutBlockRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Entity; - -use Doctrine\ORM\EntityRepository; - -/** - * ContentRepository - * - * @author net working AG - */ -class LayoutBlockRepository extends EntityRepository -{ -} diff --git a/Entity/Media.php b/Entity/Media.php index 785b46626..54f85b01a 100644 --- a/Entity/Media.php +++ b/Entity/Media.php @@ -10,54 +10,41 @@ namespace Networking\InitCmsBundle\Entity; - -use Doctrine\ORM\Mapping as ORM, - Sonata\MediaBundle\Entity\BaseMedia as BaseMedia, - Networking\InitCmsBundle\Entity\Tag, - Doctrine\Common\Collections\ArrayCollection; +use Doctrine\ORM\Mapping as ORM; +use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia; +use Doctrine\Common\Collections\ArrayCollection; /** + * Class Media + * @package Networking\InitCmsBundle\Entity * @author Yorkie Chadwick - * - * Networking\InitCmsBundle\Entity\Media - * - * @ORM\Table(name="media__media") - * @ORM\Entity() */ class Media extends BaseMedia { /** * @var integer $id - * - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - * */ protected $id; /** * @var ArrayCollection $tags - * - */ protected $tags; /** * @var string $locale - * @ORM\Column(name="locale", type="string", nullable=true) */ protected $locale; /** * @var ArrayCollection $galleryHasMedias - * - * @ORM\OneToMany(targetEntity="Networking\InitCmsBundle\Entity\GalleryHasMedia", mappedBy="media", orphanRemoval=true) */ protected $galleryHasMedias; - + /** + * + */ public function __construct() { $this->tags = new ArrayCollection(); @@ -76,7 +63,7 @@ public function getId() /** * Add tags * - * @param \Networking\InitCmsBundle\Entity\Tag $tag + * @param \Networking\InitCmsBundle\Entity\Tag $tag * @return $this */ public function addTags(Tag $tag) diff --git a/Entity/MenuItem.php b/Entity/MenuItem.php index bdcf4970b..1e72ce15b 100644 --- a/Entity/MenuItem.php +++ b/Entity/MenuItem.php @@ -1,5 +1,4 @@ + * Class MenuItem + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class MenuItem extends ModelMenuItem { /** + * Hook on pre-persist operations */ public function prePersist() { diff --git a/Entity/MenuItemManager.php b/Entity/MenuItemManager.php index ff9432e30..d667f98c9 100644 --- a/Entity/MenuItemManager.php +++ b/Entity/MenuItemManager.php @@ -1,9 +1,11 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Networking\InitCmsBundle\Entity; @@ -12,9 +14,17 @@ use Networking\InitCmsBundle\Model\MenuItemManagerInterface; use Doctrine\ORM\EntityManager; - -class MenuItemManager extends NestedTreeRepository implements MenuItemManagerInterface{ - +/** + * Class MenuItemManager + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick + */ +class MenuItemManager extends NestedTreeRepository implements MenuItemManagerInterface +{ + /** + * @param EntityManager $em + * @param \Doctrine\ORM\Mapping\ClassMetadata $class + */ public function __construct(EntityManager $em, $class) { $classMetaData = $em->getClassMetadata($class); @@ -38,8 +48,23 @@ public function getRootNodesByLocale($locale, $sortByField = null, $direction = return $rootNodesQueryBuilder->getQuery()->getResult(); } - public function getChildrenByStatus($node = null, $direct = false, $sortByField = null, $direction = 'ASC', $includeNode = false, $viewStatus = BasePage::STATUS_PUBLISHED) - { + /** + * @param null $node + * @param bool $direct + * @param null $sortByField + * @param string $direction + * @param bool $includeNode + * @param string $viewStatus + * @return array + */ + public function getChildrenByStatus( + $node = null, + $direct = false, + $sortByField = null, + $direction = 'ASC', + $includeNode = false, + $viewStatus = BasePage::STATUS_PUBLISHED + ) { $qb = $this->childrenQueryBuilder($node, $direct, $sortByField, $direction, $includeNode); $aliases = $qb->getRootAliases(); @@ -50,13 +75,13 @@ public function getChildrenByStatus($node = null, $direct = false, $sortByField $qb->leftJoin('p.snapshots', 'ps'); $qb->leftJoin('ps.contentRoute', 'cr'); $qb->andWhere($qb->expr()->orX('p.id = ps.page', 'p.id IS NULL')); - }else{ + } else { $qb->leftJoin('p.contentRoute', 'cr'); } $results = $qb->getQuery()->getResult(); $menuItems = array(); - foreach($results as $item){ + foreach ($results as $item) { $menuItem = $item[0]; $menuItem->setPath($item['path']); $menuItems[] = $menuItem; diff --git a/Entity/PageListener.php b/Entity/PageListener.php index 99d663b79..96b019ff5 100644 --- a/Entity/PageListener.php +++ b/Entity/PageListener.php @@ -15,8 +15,11 @@ use Networking\InitCmsBundle\Model\PageInterface; use Networking\InitCmsBundle\Helper\PageHelper; use Networking\InitCmsBundle\Model\PageListener as ModelPageListener; + /** - * @author net working AG + * Class PageListener + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class PageListener extends ModelPageListener { diff --git a/Entity/PageManager.php b/Entity/PageManager.php index 170e62dd6..f41f43ab3 100644 --- a/Entity/PageManager.php +++ b/Entity/PageManager.php @@ -1,27 +1,33 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle\Entity; use Doctrine\ORM\EntityManager; - use Gedmo\Tree\Entity\Repository\MaterializedPathRepository; use Networking\InitCmsBundle\Model\PageInterface; use Networking\InitCmsBundle\Model\PageManagerInterface; -use Networking\InitCmsBundle\Model\PageSnapshotInterface; -use Symfony\Cmf\Component\Routing\ContentRepositoryInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** - * PageRepository - * - * @author net working AG + * Class PageManager + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class PageManager extends MaterializedPathRepository implements PageManagerInterface { - + /** + * @param EntityManager $om + * @param \Doctrine\ORM\Mapping\ClassMetadata $class + */ public function __construct(EntityManager $om, $class) { $classMetaData = $om->getClassMetadata($class); diff --git a/Entity/PageSnapshot.php b/Entity/PageSnapshot.php index 64f49b464..2295b7213 100644 --- a/Entity/PageSnapshot.php +++ b/Entity/PageSnapshot.php @@ -7,10 +7,16 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Entity; use Networking\InitCmsBundle\Model\PageSnapshot as ModelPageSnapshot; +/** + * Class PageSnapshot + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick + */ class PageSnapshot extends ModelPageSnapshot { diff --git a/Entity/PageSnapshotManager.php b/Entity/PageSnapshotManager.php index 371848044..7f7b33dd7 100644 --- a/Entity/PageSnapshotManager.php +++ b/Entity/PageSnapshotManager.php @@ -1,23 +1,31 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Networking\InitCmsBundle\Entity; -use Networking\InitCmsBundle\Entity\PageSnapshot; use Doctrine\ORM\EntityRepository; use Networking\InitCmsBundle\Model\PageSnapshotManagerInterface; use Doctrine\ORM\EntityManager; +/** + * Class PageSnapshotManager + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick + */ +class PageSnapshotManager extends EntityRepository implements PageSnapshotManagerInterface +{ -class PageSnapshotManager extends EntityRepository implements PageSnapshotManagerInterface{ - - + /** + * @param EntityManager $em + * @param \Doctrine\ORM\Mapping\ClassMetadata $class + */ public function __construct(EntityManager $em, $class) { $classMetaData = $em->getClassMetadata($class); @@ -25,12 +33,17 @@ public function __construct(EntityManager $em, $class) parent::__construct($em, $classMetaData); } + /** + * @param $pageId + * @return mixed + */ public function findSnapshotByPageId($pageId) { $qb = $this->createQueryBuilder('ps') ->where('ps.page = :pageId') ->orderBy('ps.version', 'desc') ->setParameter(':pageId', $pageId); + return $qb->getQuery()->execute(); } diff --git a/Entity/ResourceVersion.php b/Entity/ResourceVersion.php index 3af082490..9cda17a31 100644 --- a/Entity/ResourceVersion.php +++ b/Entity/ResourceVersion.php @@ -8,11 +8,13 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Entity; use Networking\InitCmsBundle\Model\ResourceVersion as ModelResourceVersion; + /** + * Class ResourceVersion + * @package Networking\InitCmsBundle\Entity * @author Yorkie Chadwick */ class ResourceVersion extends ModelResourceVersion{ diff --git a/Entity/Tag.php b/Entity/Tag.php index 7fa240653..74aaafe2a 100644 --- a/Entity/Tag.php +++ b/Entity/Tag.php @@ -1,5 +1,4 @@ + * Class Tag + * @package Networking\InitCmsBundle\Entity + * @author Yorkie Chadwick */ class Tag extends ModelTag { /** * @var integer $id - * */ protected $id; } diff --git a/Entity/TagRepository.php b/Entity/TagRepository.php deleted file mode 100644 index 41669f8ea..000000000 --- a/Entity/TagRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Entity; - -use Doctrine\ORM\EntityRepository; - -/** - * TagRepository - * - * @author net working AG - */ -class TagRepository extends EntityRepository -{ -} diff --git a/Entity/Text.php b/Entity/Text.php index ca0f9407f..f93f559b6 100644 --- a/Entity/Text.php +++ b/Entity/Text.php @@ -8,10 +8,11 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Entity; /** + * Class Text + * @package Networking\InitCmsBundle\Entity * @author Yorkie Chadwick */ class Text extends BaseText{ diff --git a/Entity/TextRepository.php b/Entity/TextRepository.php deleted file mode 100644 index 3fa394a3d..000000000 --- a/Entity/TextRepository.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace Networking\InitCmsBundle\Entity; - -use Doctrine\ORM\EntityRepository; - -/** - * ContentRepository - * - * @author net working AG - */ -class TextRepository extends EntityRepository -{ -} diff --git a/Entity/UserManager.php b/Entity/UserManager.php index 27f1785a0..c21f77ad4 100644 --- a/Entity/UserManager.php +++ b/Entity/UserManager.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Entity; use Doctrine\ORM\EntityManager; @@ -17,12 +16,24 @@ use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; /** + * Class UserManager + * @package Networking\InitCmsBundle\Entity * @author Yorkie Chadwick */ class UserManager extends DoctrineUserManager { + /** + * @var \Doctrine\ORM\EntityManager + */ protected $em; + /** + * @param EncoderFactoryInterface $encoderFactory + * @param CanonicalizerInterface $usernameCanonicalizer + * @param CanonicalizerInterface $emailCanonicalizer + * @param EntityManager $em + * @param string $class + */ public function __construct( EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, @@ -35,6 +46,9 @@ public function __construct( $this->em = $em; } + /** + * @return mixed + */ public function getLatestActivity() { $tenMinutesAgo = new \DateTime('- 10 minutes'); diff --git a/EventListener/AdminTrackerListener.php b/EventListener/AdminTrackerListener.php index 9f4583856..eb72ad086 100644 --- a/EventListener/AdminTrackerListener.php +++ b/EventListener/AdminTrackerListener.php @@ -9,14 +9,12 @@ */ namespace Networking\InitCmsBundle\EventListener; -use Symfony\Component\EventDispatcher\EventSubscriberInterface, - Symfony\Component\Security\Http\AccessMapInterface, - Sonata\AdminBundle\Admin\Pool, - Symfony\Component\HttpKernel\Event\GetResponseEvent, - Sonata\AdminBundle\Admin\AdminInterface, - Symfony\Component\HttpFoundation\Session\Session; +use Sonata\AdminBundle\Admin\Pool; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; /** + * Class AdminTrackerListener + * @package Networking\InitCmsBundle\EventListener * @author sonja brodersen */ class AdminTrackerListener @@ -58,16 +56,19 @@ public function onKernelRequest(GetResponseEvent $event) $adminCode = $request->get('_sonata_admin'); - if(!is_null($adminCode)){ + if (!is_null($adminCode)) { $this->admin = $this->adminPool->getAdminByAdminCode($adminCode); if (!$this->admin) { - throw new \RuntimeException(sprintf('Unable to find the admin class related to the current controller (%s)', get_class($this))); + throw new \RuntimeException(sprintf( + 'Unable to find the admin class related to the current controller (%s)', + get_class($this) + )); } - if(method_exists($this->admin, 'getTrackedActions')){ - foreach($this->admin->getTrackedActions() as $trackedAction){ + if (method_exists($this->admin, 'getTrackedActions')) { + foreach ($this->admin->getTrackedActions() as $trackedAction) { // if an action which is flagged as 'to be tracked' is matching the end of the route: add info to session - if(preg_match('#'.$trackedAction.'$#', $request->get('_route'), $matches)){ + if (preg_match('#' . $trackedAction . '$#', $request->get('_route'), $matches)) { $this->updateTrackedInfo( $request->getSession(), '_networking_initcms_admin_tracker', @@ -80,8 +81,6 @@ public function onKernelRequest(GetResponseEvent $event) } } } - - } } @@ -93,11 +92,11 @@ public function onKernelRequest(GetResponseEvent $event) * @param array $trackInfoArray * @param int $limit */ - protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $limit=5) + protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $limit = 5) { // save the url, controller and action in the session $value = json_decode($session->get($sessionKey), true); - if(is_null($value)){ + if (is_null($value)) { $value = array(); } // add new value as first value (to the top of the stack) @@ -107,7 +106,7 @@ protected function updateTrackedInfo($session, $sessionKey, $trackInfoArray, $li ); // remove last value, if array has more than limit items - if($limit > 0 AND count($value) > $limit){ + if ($limit > 0 AND count($value) > $limit) { array_pop($value); } diff --git a/EventListener/LocaleListener.php b/EventListener/LocaleListener.php index e8a92ab3b..2d031038a 100644 --- a/EventListener/LocaleListener.php +++ b/EventListener/LocaleListener.php @@ -1,5 +1,4 @@ + * Class LocaleListener + * @package Networking\InitCmsBundle\EventListener + * @author Yorkie Chadwick */ class LocaleListener implements EventSubscriberInterface { diff --git a/EventListener/UserActivityListener.php b/EventListener/UserActivityListener.php index 41411d178..53e67627d 100644 --- a/EventListener/UserActivityListener.php +++ b/EventListener/UserActivityListener.php @@ -10,20 +10,23 @@ namespace Networking\InitCmsBundle\EventListener; - -/** - * @author Yorkie Chadwick - */ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use DateTime; use Networking\InitCmsBundle\Model\UserInterface; use Doctrine\Common\Persistence\ObjectManager; +/** + * Class UserActivityListener + * @package Networking\InitCmsBundle\EventListener + * @author Yorkie Chadwick + */ class UserActivityListener implements ContainerAwareInterface { + /** + * @var SecurityContext + */ protected $context; /** @@ -74,7 +77,6 @@ public function onCoreController(FilterControllerEvent $event) $this->em->persist($user); $this->em->flush($user); - } } } diff --git a/Filter/SimpleStringFilter.php b/Filter/SimpleStringFilter.php index 170f4780a..ec106d65a 100644 --- a/Filter/SimpleStringFilter.php +++ b/Filter/SimpleStringFilter.php @@ -7,11 +7,15 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Filter; -use Sonata\AdminBundle\Datagrid\ProxyQueryInterface, - Sonata\DoctrineORMAdminBundle\Filter\Filter; +use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; +use Sonata\DoctrineORMAdminBundle\Filter\Filter; + /** + * Class SimpleStringFilter + * @package Networking\InitCmsBundle\Filter * @author Yorkie Chadwick */ class SimpleStringFilter extends Filter @@ -46,7 +50,7 @@ public function filter(ProxyQueryInterface $queryBuilder, $alias, $field, $data) public function getDefaultOptions() { return array( - 'format' => '%%%s%%' + 'format' => '%%%s%%' ); } @@ -55,10 +59,13 @@ public function getDefaultOptions() */ public function getRenderSettings() { - return array('sonata_type_filter_default', array( - 'field_type' => $this->getFieldType(), - 'field_options' => $this->getFieldOptions(), - 'label' => $this->getLabel() - )); + return array( + 'sonata_type_filter_default', + array( + 'field_type' => $this->getFieldType(), + 'field_options' => $this->getFieldOptions(), + 'label' => $this->getLabel() + ) + ); } } diff --git a/Fixtures/LoadHelpText.php b/Fixtures/LoadHelpText.php index dda576d7a..9a62ccbd9 100644 --- a/Fixtures/LoadHelpText.php +++ b/Fixtures/LoadHelpText.php @@ -1,5 +1,4 @@ + */ class LoadHelpText extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { /** @@ -42,35 +45,40 @@ class LoadHelpText extends AbstractFixture implements OrderedFixtureInterface, C 'is_deletable' => '1' ), //pages - 'networking_init_cms.page.admin.page.list' => array( - 'title' => 'networking_init_cms.page.admin.page.list.title', - 'text' => 'networking_init_cms.page.admin.page.list.text', + 'networking_init_cms.admin.page.list' => array( + 'title' => 'networking_init_cms.admin.page.list.title', + 'text' => 'networking_init_cms.admin.page.list.text', 'is_deletable' => '1' ), - 'networking_init_cms.page.admin.page.create' => array( - 'title' => 'networking_init_cms.page.admin.page.create.title', - 'text' => 'networking_init_cms.page.admin.page.create.text', + 'networking_init_cms.admin.page.create' => array( + 'title' => 'networking_init_cms.admin.page.create.title', + 'text' => 'networking_init_cms.admin.page.create.text', 'is_deletable' => '1' ), - 'networking_init_cms.page.admin.page.edit' => array( - 'title' => 'networking_init_cms.page.admin.page.edit.title', - 'text' => 'networking_init_cms.page.admin.page.edit.text', + 'networking_init_cms.admin.page.edit' => array( + 'title' => 'networking_init_cms.admin.page.edit.title', + 'text' => 'networking_init_cms.admin.page.edit.text', 'is_deletable' => '1' ), //menu - 'networking_init_cms.menu.admin.menu_item.navigation' => array( - 'title' => 'networking_init_cms.menu.admin.menu_item.navigation.title', - 'text' => 'networking_init_cms.menu.admin.menu_item.navigation.text', + 'networking_init_cms.admin.menu_item.navigation' => array( + 'title' => 'networking_init_cms.admin.menu_item.navigation.title', + 'text' => 'networking_init_cms.admin.menu_item.navigation.text', 'is_deletable' => '1' ), - 'networking_init_cms.menu.admin.menu.create' => array( - 'title' => 'networking_init_cms.menu.admin.menu.create.title', - 'text' => 'networking_init_cms.menu.admin.menu.create.text', + 'networking_init_cms.admin.menu.create' => array( + 'title' => 'networking_init_cms.admin.menu.create.title', + 'text' => 'networking_init_cms.admin.menu.create.text', 'is_deletable' => '1' ), - 'networking_init_cms.menu.admin.menu_item.create' => array( - 'title' => 'networking_init_cms.menu.admin.menu_item.create.title', - 'text' => 'networking_init_cms.menu.admin.menu_item.create.text', + 'networking_init_cms.admin.menu_item.create' => array( + 'title' => 'networking_init_cms.admin.menu_item.create.title', + 'text' => 'networking_init_cms.admin.menu_item.create.text', + 'is_deletable' => '1' + ), + 'networking_init_cms.admin.menu_item.edit' => array( + 'title' => 'networking_init_cms.admin.menu_item.edit.title', + 'text' => 'networking_init_cms.admin.menu_item.edit.text', 'is_deletable' => '1' ), //media @@ -79,25 +87,46 @@ class LoadHelpText extends AbstractFixture implements OrderedFixtureInterface, C 'text' => 'sonata.media.admin.media.list.text', 'is_deletable' => '1' ), + 'sonata.media.admin.media.create' => array( + 'title' => 'sonata.media.admin.media.create.title', + 'text' => 'sonata.media.admin.media.create.text', + 'is_deletable' => '1' + ), + 'sonata.media.admin.media.edit' => array( + 'title' => 'sonata.media.admin.media.edit.title', + 'text' => 'sonata.media.admin.media.edit.text', + 'is_deletable' => '1' + ), + //gallery 'sonata.media.admin.gallery.list' => array( 'title' => 'sonata.media.admin.gallery.list.title', 'text' => 'sonata.media.admin.gallery.list.text', 'is_deletable' => '1' ), - 'networking_init_cms.page.admin.tag.list' => array( - 'title' => 'networking_init_cms.page.admin.tag.list.title', - 'text' => 'networking_init_cms.page.admin.tag.list.text', + 'sonata.media.admin.gallery.create' => array( + 'title' => 'sonata.media.admin.gallery.create.title', + 'text' => 'sonata.media.admin.gallery.create.text', + 'is_deletable' => '1' + ), + 'sonata.media.admin.gallery.edit' => array( + 'title' => 'sonata.media.admin.gallery.edit.title', + 'text' => 'sonata.media.admin.gallery.edit.text', 'is_deletable' => '1' ), //user - 'sonata.user.admin.user.list' => array( - 'title' => 'sonata.user.admin.user.list.title', - 'text' => 'sonata.user.admin.user.list.text', + 'sonata.media.admin.user.list' => array( + 'title' => 'sonata.media.admin.user.list.title', + 'text' => 'sonata.media.admin.user.list.text', + 'is_deletable' => '1' + ), + 'sonata.media.admin.user.create' => array( + 'title' => 'sonata.media.admin.user.create.title', + 'text' => 'sonata.media.admin.user.create.text', 'is_deletable' => '1' ), - 'sonata.user.admin.group.list' => array( - 'title' => 'sonata.user.admin.group.list.title', - 'text' => 'sonata.user.admin.group.list.text', + 'sonata.media.admin.user.edit' => array( + 'title' => 'sonata.media.admin.user.edit.title', + 'text' => 'sonata.media.admin.user.edit.text', 'is_deletable' => '1' ), //not found @@ -137,17 +166,16 @@ public function load(ObjectManager $manager) ); } } - - } /** - * @param \Doctrine\Common\Persistence\ObjectManager $manager + * @param ObjectManager $manager * @param $locale * @param $translationKey * @param $title * @param $text + * @param $isDeletable */ public function createHelpText(ObjectManager $manager, $locale, $translationKey, $title, $text, $isDeletable) { diff --git a/Fixtures/LoadLayoutBlocks.php b/Fixtures/LoadLayoutBlocks.php index bf89fbb46..a5b11753e 100644 --- a/Fixtures/LoadLayoutBlocks.php +++ b/Fixtures/LoadLayoutBlocks.php @@ -1,5 +1,4 @@ + * Class LoadLayoutBlocks + * @package Networking\InitCmsBundle\Fixtures + * @author Yorkie Chadwick */ class LoadLayoutBlocks extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { @@ -79,6 +79,7 @@ public function createLayoutBlocks(ObjectManager $manager, $locale) $manager->persist($layoutBlock); $manager->flush(); + /** @var TextInterface $text */ $text = new $textClass(); $text->setText('

Hello World

The locale of this page is '.$locale.'

'); diff --git a/Fixtures/LoadMenu.php b/Fixtures/LoadMenu.php index f1e5b1c14..e02f1414e 100644 --- a/Fixtures/LoadMenu.php +++ b/Fixtures/LoadMenu.php @@ -1,5 +1,4 @@ + * Class LoadMenu + * @package Networking\InitCmsBundle\Fixtures + * @author Yorkie Chadwick */ class LoadMenu extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { diff --git a/Fixtures/LoadPageSnapshots.php b/Fixtures/LoadPageSnapshots.php index 7a7077d61..00f96182c 100644 --- a/Fixtures/LoadPageSnapshots.php +++ b/Fixtures/LoadPageSnapshots.php @@ -1,5 +1,4 @@ + * @author Yorkie Chadwick */ - class LoadPageSnapshots extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { diff --git a/Fixtures/LoadPages.php b/Fixtures/LoadPages.php index 7300b8497..f3e4913e3 100644 --- a/Fixtures/LoadPages.php +++ b/Fixtures/LoadPages.php @@ -1,5 +1,4 @@ + * Class LoadPages + * @package Networking\InitCmsBundle\Fixtures + * @author Yorkie Chadwick */ class LoadPages extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { @@ -57,14 +56,16 @@ public function load(ObjectManager $manager) */ public function createHomePages(ObjectManager $manager, $locale, $key, $languages) { - $homePage = new Page(); + $pageClass = $this->container->getParameter('networking_init_cms.admin.page.class'); + /** @var PageInterface $homePage */ + $homePage = new $pageClass; $homePage->setLocale($locale); $homePage->setPageName('Homepage ' . $locale); $homePage->setMetaTitle('Homepage ' . $locale); $homePage->setMetaKeyword('homepage'); $homePage->setMetaDescription('This is the homepage'); - $homePage->setStatus(Page::STATUS_PUBLISHED); + $homePage->setStatus(PageInterface::STATUS_PUBLISHED); $homePage->setIsHome(true); $homePage->setTemplateName($this->getFirstTemplate()); $homePage->setActiveFrom(new \DateTime('now')); diff --git a/Form/DataTransformer/MenuItemToNumberTransformer.php b/Form/DataTransformer/MenuItemToNumberTransformer.php index b7554387d..78f4c2402 100644 --- a/Form/DataTransformer/MenuItemToNumberTransformer.php +++ b/Form/DataTransformer/MenuItemToNumberTransformer.php @@ -1,5 +1,4 @@ + * Class MenuItemToNumberTransformer + * @package Networking\InitCmsBundle\Form\DataTransformer + * @author Yorkie Chadwick */ class MenuItemToNumberTransformer implements DataTransformerInterface { @@ -36,24 +38,22 @@ public function __construct(ObjectManager $om) /** * Transforms an object (menu item) to a string (number). * - * @param MenuItem|null $id - * @return string + * @param mixed $menuItem + * @return mixed|string */ public function transform($menuItem) { - if (null === $menuItem || false === $menuItem) { return ""; } - return $menuItem->getId(); } /** * Transforms a string (number) to an object (issue). * - * @param string $id + * @param string $id * @return MenuItem|null * @throws TransformationFailedException if object (issue) is not found. */ @@ -65,8 +65,7 @@ public function reverseTransform($id) $menuItem = $this->om ->getRepository('NetworkingInitCmsBundle:MenuItem') - ->findOneBy(array('id' => $id)) - ; + ->findOneBy(array('id' => $id)); if (null === $menuItem) { throw new TransformationFailedException(sprintf( diff --git a/Form/DataTransformer/PageToNumberTransformer.php b/Form/DataTransformer/PageToNumberTransformer.php index 382f9cfe6..1ea79d675 100644 --- a/Form/DataTransformer/PageToNumberTransformer.php +++ b/Form/DataTransformer/PageToNumberTransformer.php @@ -1,5 +1,4 @@ + * Class PageToNumberTransformer + * @package Networking\InitCmsBundle\Form\DataTransformer + * @author Yorkie Chadwick */ class PageToNumberTransformer implements DataTransformerInterface { @@ -26,7 +28,7 @@ class PageToNumberTransformer implements DataTransformerInterface private $om; /** - * @param ObjectManager $om + * @param \Networking\InitCmsBundle\Model\PageManagerInterface $om */ public function __construct(\Networking\InitCmsBundle\Model\PageManagerInterface $om) { @@ -36,8 +38,8 @@ public function __construct(\Networking\InitCmsBundle\Model\PageManagerInterface /** * Transforms an object (page) to a string (number). * - * @param Page|null $id - * @return string + * @param PageInterface $page + * @return mixed|string */ public function transform($page) { @@ -51,8 +53,8 @@ public function transform($page) /** * Transforms a string (number) to an object (issue). * - * @param string $id - * @return Page|null + * @param string $id + * @return PageInterface|null * @throws TransformationFailedException if object (issue) is not found. */ public function reverseTransform($id) @@ -61,8 +63,7 @@ public function reverseTransform($id) return null; } - $page = $this->om->findOneBy(array('id' => $id)) - ; + $page = $this->om->findById($id); if (null === $page) { throw new TransformationFailedException(sprintf( diff --git a/Form/Extension/Field/Type/FormTypeFieldExtension.php b/Form/Extension/Field/Type/FormTypeFieldExtension.php index a272efc75..753feda35 100644 --- a/Form/Extension/Field/Type/FormTypeFieldExtension.php +++ b/Form/Extension/Field/Type/FormTypeFieldExtension.php @@ -1,6 +1,4 @@ + * Class FormTypeFieldExtension + * @package Networking\InitCmsBundle\Form\Extension\Field\Type + * @author Yorkie Chadwick */ class FormTypeFieldExtension extends SonataFormTypeFieldExtension { @@ -35,7 +35,8 @@ public function __construct(array $defaultClasses = array()) /** * @return array */ - public function getDefaultClasses(){ + public function getDefaultClasses() + { return $this->defaultClasses; } @@ -46,6 +47,7 @@ public function getDefaultClasses(){ public function setDefaultClasses(array $defaultClasses) { $this->defaultClasses = $defaultClasses; + return $this; } } \ No newline at end of file diff --git a/Form/Type/AutocompleteType.php b/Form/Type/AutocompleteType.php index 0dbcbecc3..1662f5516 100644 --- a/Form/Type/AutocompleteType.php +++ b/Form/Type/AutocompleteType.php @@ -10,8 +10,10 @@ namespace Networking\InitCmsBundle\Form\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; + /** + * Class AutocompleteType + * @package Networking\InitCmsBundle\Form\Type * @author Yorkie Chadwick */ class AutocompleteType extends AbstractType diff --git a/Form/Type/IconradioType.php b/Form/Type/IconradioType.php index 939dc8201..2ce066ef6 100644 --- a/Form/Type/IconradioType.php +++ b/Form/Type/IconradioType.php @@ -7,21 +7,30 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Form\Type; -use Symfony\Component\OptionsResolver\OptionsResolverInterface, - Symfony\Component\Form\Extension\Core\Type\ChoiceType, - Symfony\Component\Form\FormView, - Symfony\Component\Form\FormInterface; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\FormInterface; /** + * Class IconradioType + * @package Networking\InitCmsBundle\Form\Type * @author Sonja Brodersen */ class IconradioType extends ChoiceType { + /** + * @var array + */ private $templates; - public function __construct($templates) + /** + * @param $templates + */ + public function __construct(array $templates) { $this->templates = $templates; } @@ -34,6 +43,9 @@ public function getName() return 'networking_type_iconradio'; } + /** + * @param OptionsResolverInterface $resolver + */ public function setDefaultOptions(OptionsResolverInterface $resolver) { parent::setDefaultOptions($resolver); @@ -42,6 +54,11 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) )); } + /** + * @param FormView $view + * @param FormInterface $form + * @param array $options + */ public function buildView(FormView $view, FormInterface $form, array $options) { parent::buildView($view, $form, $options); @@ -50,6 +67,9 @@ public function buildView(FormView $view, FormInterface $form, array $options) )); } + /** + * @return array + */ private function getIconsFromTemplates() { $choices = array(); diff --git a/Form/Type/MediaEntityType.php b/Form/Type/MediaEntityType.php index 784b4a769..6b71a7b19 100644 --- a/Form/Type/MediaEntityType.php +++ b/Form/Type/MediaEntityType.php @@ -14,8 +14,6 @@ use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList; use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader; use Symfony\Bridge\Doctrine\Form\Type\EntityType; -use Symfony\Component\Form\Exception\FormException; -use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; @@ -24,11 +22,10 @@ use Doctrine\Common\Persistence\ObjectManager; /** - * Class MediaType - * @package Sandbox\InitCmsBundle\Form\Type - * @author Sonja Brodersen + * Class MediaEntityType + * @package Networking\InitCmsBundle\Form\Type + * @author Yorkie Chadwick */ - class MediaEntityType extends EntityType { /** @@ -36,8 +33,14 @@ class MediaEntityType extends EntityType */ private $choiceListCache = array(); + /** + * @var null + */ public $context = null; + /** + * @var null + */ public $providerName = null; /** @@ -45,7 +48,6 @@ class MediaEntityType extends EntityType */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->setAttribute('dataType', $options['dataType']); } @@ -59,6 +61,9 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['provider_name'] = $options['provider_name']; } + /** + * {@inheritdoc} + */ public function setDefaultOptions(OptionsResolverInterface $resolver) { @@ -70,6 +75,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) if (null !== $options['context'] || null !== $options['provider_name']) { $type->context = $options['context']; $type->providerName = $options['provider_name']; + return $type->getLoader($options['em'], $options['query_builder'], $options['class']); } @@ -89,17 +95,23 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) // A second parameter ($key) is passed, so we cannot use // spl_object_hash() directly (which strictly requires // one parameter) - array_walk_recursive($choiceHashes, function (&$value) { - $value = spl_object_hash($value); - }); + array_walk_recursive( + $choiceHashes, + function (&$value) { + $value = spl_object_hash($value); + } + ); } $preferredChoiceHashes = $options['preferred_choices']; if (is_array($preferredChoiceHashes)) { - array_walk_recursive($preferredChoiceHashes, function (&$value) { - $value = spl_object_hash($value); - }); + array_walk_recursive( + $preferredChoiceHashes, + function (&$value) { + $value = spl_object_hash($value); + } + ); } // Support for custom loaders (with query builders) @@ -112,15 +124,19 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) ? spl_object_hash($options['group_by']) : $options['group_by']; - $hash = md5(json_encode(array( - spl_object_hash($options['em']), - $options['class'], - $propertyHash, - $loaderHash, - $choiceHashes, - $preferredChoiceHashes, - $groupByHash - ))); + $hash = md5( + json_encode( + array( + spl_object_hash($options['em']), + $options['class'], + $propertyHash, + $loaderHash, + $choiceHashes, + $preferredChoiceHashes, + $groupByHash + ) + ) + ); if (!isset($choiceListCache[$hash])) { $choiceListCache[$hash] = new EntityChoiceList( @@ -156,34 +172,41 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) return $em; }; - $resolver->setDefaults(array( - 'em' => null, - 'property' => null, - 'query_builder' => null, - 'loader' => $loader, - 'choices' => null, - 'choice_list' => $choiceList, - 'group_by' => null, - 'required' => false, - 'dataType' => 'entity', - 'expanded' => true, - 'provider_name' => false, - 'context' => false, - 'query_builder' => function (EntityRepository $er) { - $qb = $er->createQueryBuilder('m'); - return $qb; - } - )); + $resolver->setDefaults( + array( + 'em' => null, + 'property' => null, + 'query_builder' => null, + 'loader' => $loader, + 'choices' => null, + 'choice_list' => $choiceList, + 'group_by' => null, + 'required' => false, + 'dataType' => 'entity', + 'expanded' => true, + 'provider_name' => false, + 'context' => false, + 'query_builder' => function (EntityRepository $er) { + $qb = $er->createQueryBuilder('m'); + + return $qb; + } + ) + ); $resolver->setRequired(array('class')); - $resolver->setNormalizers(array( - 'em' => $emNormalizer, - )); + $resolver->setNormalizers( + array( + 'em' => $emNormalizer, + ) + ); - $resolver->setAllowedTypes(array( - 'loader' => array('null', 'Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface'), - )); + $resolver->setAllowedTypes( + array( + 'loader' => array('null', 'Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface'), + ) + ); $resolver->addAllowedValues(array('required' => array(false))); @@ -200,7 +223,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) public function getLoader(ObjectManager $manager, $queryBuilder, $class) { $type = $this; - $queryBuilder = function(EntityRepository $er) use ($type){ + $queryBuilder = function (EntityRepository $er) use ($type) { $queryBuilder = $er->createQueryBuilder('m'); if ($type->context) { $queryBuilder->andWhere('m.context = :context'); diff --git a/Form/Type/MultiuploadType.php b/Form/Type/MultiuploadType.php index fd1901368..2086a580b 100644 --- a/Form/Type/MultiuploadType.php +++ b/Form/Type/MultiuploadType.php @@ -7,12 +7,16 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolverInterface; + /** - * @author Marc Bissegger + * Class MultiuploadType + * @package Networking\InitCmsBundle\Form\Type + * @author Marc Bissegger */ class MultiuploadType extends AbstractType { @@ -32,6 +36,9 @@ public function getName() return 'networking_type_multiupload'; } + /** + * @param OptionsResolverInterface $resolver + */ public function setDefaultOptions(OptionsResolverInterface $resolver){ $resolver->setDefaults(array( 'error_mapping' => array( @@ -40,6 +47,4 @@ public function setDefaultOptions(OptionsResolverInterface $resolver){ )); } - // redirect to edit mode - } \ No newline at end of file diff --git a/Helper/BundleGuesser.php b/Helper/BundleGuesser.php index 683f39f8a..cd0f895ab 100644 --- a/Helper/BundleGuesser.php +++ b/Helper/BundleGuesser.php @@ -7,9 +7,12 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Helper; /** + * Class BundleGuesser + * @package Networking\InitCmsBundle\Helper * @author Yorkie Chadwick */ class BundleGuesser @@ -26,10 +29,9 @@ class BundleGuesser */ public function initialize($class) { - $this->reflector = new \ReflectionClass(get_class($class)); - return $this; + return $this; } /** diff --git a/Helper/ContentInterfaceHelper.php b/Helper/ContentInterfaceHelper.php index 1f545f18d..bcccfdcb7 100644 --- a/Helper/ContentInterfaceHelper.php +++ b/Helper/ContentInterfaceHelper.php @@ -1,5 +1,4 @@ + * Class ContentInterfaceHelper + * @package Networking\InitCmsBundle\Helper + * @author Yorkie Chadwick */ class ContentInterfaceHelper { diff --git a/Helper/LanguageSwitcherHelper.php b/Helper/LanguageSwitcherHelper.php index 5d6694708..e04707831 100644 --- a/Helper/LanguageSwitcherHelper.php +++ b/Helper/LanguageSwitcherHelper.php @@ -20,7 +20,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** - * @author net working AG + * Class LanguageSwitcherHelper + * @package Networking\InitCmsBundle\Helper + * @author Yorkie Chadwick */ class LanguageSwitcherHelper { diff --git a/Helper/PageHelper.php b/Helper/PageHelper.php index fcd6e347e..6d560f3f9 100644 --- a/Helper/PageHelper.php +++ b/Helper/PageHelper.php @@ -7,16 +7,16 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Networking\InitCmsBundle\Helper; -use - Sonata\AdminBundle\Exception\NoValueException, - Symfony\Component\DependencyInjection\ContainerInterface, - Doctrine\ORM\EntityManager, - Networking\InitCmsBundle\Model\ContentRoute; +use Sonata\AdminBundle\Exception\NoValueException; +use Symfony\Component\DependencyInjection\ContainerInterface; use Networking\InitCmsBundle\Model\PageInterface; /** + * Class PageHelper + * @package Networking\InitCmsBundle\Helper * @author Yorkie Chadwick */ class PageHelper @@ -159,6 +159,15 @@ public function getService($id) return $this->container->get($id); } + /** + * @param $id + * @return mixed + */ + public function getParameter($id) + { + return $this->container->getParameter($id); + } + /** * Create a snapshot of a given page. * @@ -169,13 +178,18 @@ public function makePageSnapshot(PageInterface $page) /** @var \JMS\Serializer\SerializerInterface $serializer */ $serializer = $this->getService('serializer'); - /** @var \Doctrine\Common\Persistence\ObjectManager $manager */ - $manager = $this->getService('doctrine')->getManager(); + if ($this->getParameter('networking_init_cms.db_driver') == 'orm') { + /** @var \Doctrine\Common\Persistence\ObjectManager $em */ + $em = $this->getService('doctrine')->getManager(); + } else { + /** @var \Doctrine\Common\Persistence\ObjectManager $manager */ + $em = $this->getService('doctrine_mongodb')->getManager(); + } foreach ($page->getLayoutBlock() as $layoutBlock) { /** @var \Networking\InitCmsBundle\Model\layoutBlockInterface $layoutBlock */ - $layoutBlockContent = $manager->getRepository($layoutBlock->getClassType())->find( + $layoutBlockContent = $em->getRepository($layoutBlock->getClassType())->find( $layoutBlock->getObjectId() ); $layoutBlock->takeSnapshot($serializer->serialize($layoutBlockContent, 'json')); @@ -195,23 +209,23 @@ public function makePageSnapshot(PageInterface $page) $contentRouteManager = $this->getService('networking_init_cms.content_route_manager'); - $contentRouteClass = $contentRouteManager->getClassName(); + $contentRouteClass = $contentRouteManager->getClass(); /** @var \Networking\InitCmsBundle\Model\ContentRouteInterface $snapshotContentRoute */ - $snapshotContentRoute = $contentRouteClass(); + $snapshotContentRoute = new $contentRouteClass(); } $pageSnapshot->setContentRoute($snapshotContentRoute); $pageSnapshot->setPath(self::getPageRoutePath($page->getPath())); - $manager->persist($pageSnapshot); - $manager->flush(); + $em->persist($pageSnapshot); + $em->flush(); $snapshotContentRoute->setPath(self::getPageRoutePath($page->getPath())); $snapshotContentRoute->setObjectId($pageSnapshot->getId()); - $manager->persist($snapshotContentRoute); - $manager->flush(); + $em->persist($snapshotContentRoute); + $em->flush(); } /** @@ -223,12 +237,18 @@ public function makePageSnapshot(PageInterface $page) */ public function makeTranslationCopy(PageInterface $page, $locale) { - $doctrine = $this->getService('doctrine'); - $em = $doctrine->getManager(); + if ($this->getParameter('networking_init_cms.db_driver') == 'orm') { + /** @var \Doctrine\Common\Persistence\ObjectManager $em */ + $em = $this->getService('doctrine')->getManager(); + } else { + /** @var \Doctrine\Common\Persistence\ObjectManager $em */ + $em = $this->getService('doctrine_mongodb')->getManager(); + } /** @var \Networking\InitCmsBundle\Model\PageManagerInterface $pageManger */ $pageManger = $this->getService('networking_init_cms.page_manager'); + $pageClass = $pageManger->getClassName(); /** @var PageInterface $pageCopy */ $pageCopy = new $pageClass; @@ -251,7 +271,7 @@ public function makeTranslationCopy(PageInterface $page, $locale) /** @var $newLayoutBlock \Networking\InitCmsBundle\Model\LayoutBlockInterface */ $newLayoutBlock = clone $layoutBlock; - $content = $doctrine->getRepository($newLayoutBlock->getClassType())->find( + $content = $em->getRepository($newLayoutBlock->getClassType())->find( $newLayoutBlock->getObjectId() ); $newContent = clone $content; diff --git a/Model/AdminSettingsInterface.php b/Model/AdminSettingsInterface.php index 69f865041..3568af911 100644 --- a/Model/AdminSettingsInterface.php +++ b/Model/AdminSettingsInterface.php @@ -10,9 +10,9 @@ namespace Networking\InitCmsBundle\Model; /** - * @author Yorkie Chadwick - * + * Class AdminSettingsInterface * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick */ interface AdminSettingsInterface { diff --git a/Model/ContentRouteManager.php b/Model/ContentRouteManager.php index 8c1aeb095..764b8f29a 100644 --- a/Model/ContentRouteManager.php +++ b/Model/ContentRouteManager.php @@ -45,6 +45,9 @@ public function setClassName($className = null) $this->className = $className; } + public function getClass(){ + return $this->class; + } /** * {@inheritDoc} diff --git a/Model/MenuItem.php b/Model/MenuItem.php index 75b897bc0..79cfe08f1 100644 --- a/Model/MenuItem.php +++ b/Model/MenuItem.php @@ -15,8 +15,6 @@ use Networking\InitCmsBundle\Model\PageInterface; /** - * @Gedmo\Tree(type="nested") - * * @author net working AG */ class MenuItem implements MenuItemInterface, \IteratorAggregate @@ -29,68 +27,88 @@ class MenuItem implements MenuItemInterface, \IteratorAggregate /** + * @var int */ protected $id; /** + * @var string */ protected $name; /** + * @var PageInterface */ protected $page; - /** + * @var string */ protected $redirectUrl; + /** + * @var string */ protected $internalUrl; + /** + * @var boolean */ protected $hidden; + /** + * @var string */ protected $linkTarget; + /** + * @var string */ protected $linkClass; + /** + * @var string */ protected $linkRel; + /** - * @Gedmo\TreeLeft + * @var int */ protected $lft; + /** - * @Gedmo\TreeLevel + * @var int */ protected $lvl; + /** - * @Gedmo\TreeRight + * @var int */ protected $rgt; + /** - * @Gedmo\TreeRoot + * @var int */ protected $root; + /** - * @Gedmo\TreeParent + * @var MenuItemInterface */ protected $parent; + /** + * @var \Doctrine\Common\Collections\ArrayCollection */ protected $children; @@ -100,7 +118,7 @@ class MenuItem implements MenuItemInterface, \IteratorAggregate protected $isRoot = false; /** - * @var string $locale; + * @var string $locale ; */ protected $locale; @@ -137,7 +155,9 @@ public function __toString() return (string)$this->name; } + /** + * */ public function prePersist() { @@ -240,7 +260,7 @@ public function getInternalUrl() /** * @param $name - * @return MenuItem + * @return $this */ public function setName($name) { @@ -266,11 +286,12 @@ public function getName() public function setParent(MenuItemInterface $parent = null) { $this->parent = $parent; + return $this; } /** - * @return mixed + * @return MenuItemInterface */ public function getParent() { @@ -289,7 +310,7 @@ public function setLft($lft) } /** - * @return mixed + * @return int */ public function getLft() { @@ -308,7 +329,7 @@ public function setLvl($lvl) } /** - * @return mixed + * @return int */ public function getLvl() { @@ -327,7 +348,7 @@ public function setRgt($rgt) } /** - * @return mixed + * @return int */ public function getRgt() { @@ -346,7 +367,7 @@ public function setRoot($root) } /** - * @return mixed + * @return int */ public function getRoot() { @@ -354,7 +375,7 @@ public function getRoot() } /** - * @return MenuItem + * @return MenuItemInterface */ public function getMenu() { @@ -398,7 +419,7 @@ public function getRootParent(MenuItemInterface $menuItem) } /** - * @param int $level + * @param int $level * @return bool|MenuItemInterface */ public function getParentByLevel($level = 1) @@ -482,6 +503,7 @@ public function getChildrenByStatus($status) public function setPath($path) { $this->path = $path; + return $this; } @@ -490,7 +512,7 @@ public function setPath($path) */ public function getPath() { - if($this->path){ + if ($this->path) { return $this->path; } @@ -514,7 +536,7 @@ public function getRouteId() } /** - * @param null $locale + * @param null $locale * @return $this */ public function setLocale($locale = null) diff --git a/Model/MenuItemInterface.php b/Model/MenuItemInterface.php index a7c31efb6..9858ca83c 100644 --- a/Model/MenuItemInterface.php +++ b/Model/MenuItemInterface.php @@ -8,28 +8,22 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; - /** + * Class MenuItemInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface MenuItemInterface { - /** - * @var string - */ + const PATH_SEPARATOR = '/'; - /** - * - */ + const VISIBILITY_PUBLIC = 'public'; - /** - * - */ + const VISIBILITY_PROTECTED = 'protected'; /** @@ -56,7 +50,7 @@ public function getPage(); public function setRedirectUrl($redirectUrl); /** - * @return mixed + * @return string */ public function getRedirectUrl(); @@ -65,12 +59,12 @@ public function getRedirectUrl(); */ public function setHidden($hidden); /** - * @return mixed + * @return boolean */ public function getHidden(); /** - * @return mixed + * @return boolean */ public function isHidden(); @@ -80,7 +74,7 @@ public function isHidden(); public function setInternalUrl($route); /** - * @return mixed + * @return string */ public function getInternalUrl(); @@ -104,7 +98,7 @@ public function getName(); public function setParent(MenuItemInterface $parent = null); /** - * @return mixed + * @return MenuItemInterface */ public function getParent(); @@ -125,7 +119,7 @@ public function getLft(); public function setLvl($lvl); /** - * @return mixed + * @return int */ public function getLvl(); @@ -136,7 +130,7 @@ public function getLvl(); public function setRgt($rgt); /** - * @return mixed + * @return int */ public function getRgt(); @@ -147,7 +141,7 @@ public function getRgt(); public function setRoot($root); /** - * @return mixed + * @return int */ public function getRoot(); diff --git a/Model/MenuItemManagerInterface.php b/Model/MenuItemManagerInterface.php index 3cf2d4dd7..8cd4ceed4 100644 --- a/Model/MenuItemManagerInterface.php +++ b/Model/MenuItemManagerInterface.php @@ -8,18 +8,38 @@ namespace Networking\InitCmsBundle\Model; - -interface MenuItemManagerInterface { +/** + * Class MenuItemManagerInterface + * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick + */ +interface MenuItemManagerInterface +{ /** - * @param $locale - * @param null $sortByField - * @param string $direction - * @return array - */ + * @param $locale + * @param null $sortByField + * @param string $direction + * @return array + */ public function getRootNodesByLocale($locale, $sortByField = null, $direction = 'asc'); - - public function getChildrenByStatus($node = null, $direct = false, $sortByField = null, $direction = 'ASC', $includeNode = false, $viewStatus = BasePage::STATUS_PUBLISHED); + /** + * @param null $node + * @param bool $direct + * @param null $sortByField + * @param string $direction + * @param bool $includeNode + * @param $viewStatus + * @return mixed + */ + public function getChildrenByStatus( + $node = null, + $direct = false, + $sortByField = null, + $direction = 'ASC', + $includeNode = false, + $viewStatus = BasePage::STATUS_PUBLISHED + ); } \ No newline at end of file diff --git a/Model/ModelChangedListener.php b/Model/ModelChangedListener.php index 3355a45e5..1e6138378 100644 --- a/Model/ModelChangedListener.php +++ b/Model/ModelChangedListener.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Doctrine\Common\EventArgs; @@ -18,6 +17,8 @@ use Symfony\Component\Security\Core\SecurityContext; /** + * Class ModelChangedListener + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ abstract class ModelChangedListener implements ModelChangedListenerInterface, ContainerAwareInterface diff --git a/Model/ModelChangedListenerInterface.php b/Model/ModelChangedListenerInterface.php index 780a8a1fd..979a0adb6 100644 --- a/Model/ModelChangedListenerInterface.php +++ b/Model/ModelChangedListenerInterface.php @@ -7,13 +7,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Doctrine\Common\EventArgs; /** + * Class ModelChangedListenerInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface ModelChangedListenerInterface { diff --git a/Model/Page.php b/Model/Page.php index 6c18bde27..798cbb430 100644 --- a/Model/Page.php +++ b/Model/Page.php @@ -20,11 +20,9 @@ use Gedmo\Mapping\Annotation as Gedmo; /** - * Networking\InitCmsBundle\Entity\Page - * - * @Gedmo\Tree(type="materializedPath") - * - * @author net working AG + * Class Page + * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick */ abstract class Page implements PageInterface { @@ -57,13 +55,11 @@ abstract class Page implements PageInterface /** * @var string $url - * @Gedmo\TreePathSource */ protected $url; /** * @var string $path - * @Gedmo\TreePath(separator="/") */ protected $path; @@ -83,7 +79,6 @@ abstract class Page implements PageInterface protected $metaDescription; /** - * @Gedmo\TreeParent * @var PageInterface|NULL */ protected $parent; @@ -103,10 +98,8 @@ abstract class Page implements PageInterface */ protected $allChildren = array(); - /** * @var ArrayCollection $layoutBlock - * */ protected $layoutBlock; @@ -182,6 +175,7 @@ public function __construct() } /** + * Hook on to pre-persist action */ public function prePersist() { @@ -192,6 +186,9 @@ public function prePersist() } } + /** + * Hook on to pre-update action + */ public function preUpdate() { $this->setUpdatedAt(); @@ -496,6 +493,7 @@ public function setAllChildren($children) * * @param string $status * @return $this + * @throws \InvalidArgumentException */ public function setStatus($status) { @@ -522,6 +520,7 @@ public function getStatus() * * @param string $visibility * @return $this + * @throws \InvalidArgumentException */ public function setVisibility($visibility) { @@ -995,8 +994,6 @@ public function setContentRoute(ContentRouteInterface $contentRoute) } - - /** * @param $snapshots * @return $this @@ -1180,7 +1177,7 @@ public static function getVisibilityList() } /** - * @return $thisSnapshot + * @return mixed|PageSnapshotInterface */ public function getSnapshot() { @@ -1321,6 +1318,9 @@ public function convertOriginalsToIntegerArray() return $originals; } + /** + * @return string + */ public function getStatusLabel() { if ($this->isPublished()) { diff --git a/Model/PageInterface.php b/Model/PageInterface.php index 5dfbf304c..dc6d33a86 100644 --- a/Model/PageInterface.php +++ b/Model/PageInterface.php @@ -12,6 +12,8 @@ namespace Networking\InitCmsBundle\Model; /** + * Class PageInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface PageInterface extends \Symfony\Cmf\Component\Routing\RouteReferrersReadInterface, \Networking\InitCmsBundle\Doctrine\Extensions\Versionable\VersionableInterface diff --git a/Model/PageListener.php b/Model/PageListener.php index 3ac6e79a7..054770ae2 100644 --- a/Model/PageListener.php +++ b/Model/PageListener.php @@ -8,15 +8,15 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use JMS\Serializer\EventDispatcher\EventSubscriberInterface; - /** + * Class PageListener + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ abstract class PageListener implements EventSubscriberInterface, PageListenerInterface, ContainerAwareInterface @@ -36,7 +36,6 @@ abstract class PageListener implements EventSubscriberInterface, PageListenerInt * * @param ContainerInterface|null $container A ContainerInterface instance or null * - * @api */ public function setContainer(ContainerInterface $container = null) { diff --git a/Model/PageListenerInterface.php b/Model/PageListenerInterface.php index d5c7d44c1..1c28ba355 100644 --- a/Model/PageListenerInterface.php +++ b/Model/PageListenerInterface.php @@ -7,14 +7,14 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Doctrine\Common\EventArgs; - /** + * Class PageListenerInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface PageListenerInterface { diff --git a/Model/PageManagerInterface.php b/Model/PageManagerInterface.php index c94f81e23..e1dc820ea 100644 --- a/Model/PageManagerInterface.php +++ b/Model/PageManagerInterface.php @@ -8,15 +8,15 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Gedmo\Tree\RepositoryInterface; use Symfony\Cmf\Component\Routing\ContentRepositoryInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Doctrine\Common\Persistence\ObjectRepository; /** + * Class PageManagerInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface PageManagerInterface extends ContentRepositoryInterface, RepositoryInterface, ObjectRepository @@ -24,8 +24,8 @@ interface PageManagerInterface extends ContentRepositoryInterface, RepositoryInt /** * @param $locale - * @param null $id - * @return \Doctrine\ORM\QueryBuilder + * @param null $id + * @return mixed */ public function getParentPagesQuery($locale, $id = null); diff --git a/Model/PageSnapshot.php b/Model/PageSnapshot.php index faa5b42e4..7d61cdf71 100644 --- a/Model/PageSnapshot.php +++ b/Model/PageSnapshot.php @@ -1,10 +1,11 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Networking\InitCmsBundle\Model; @@ -12,11 +13,11 @@ use Networking\InitCmsBundle\Doctrine\Extensions\Versionable\VersionableInterface; /** + * Class PageSnapshot + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick - * */ - -class PageSnapshot implements PageSnapshotInterface{ +abstract class PageSnapshot implements PageSnapshotInterface{ /** * @var integer $id * @@ -34,27 +35,32 @@ class PageSnapshot implements PageSnapshotInterface{ protected $contentRoute; /** + * @var string */ protected $resourceName; /** + * @var int */ protected $resourceId; /** + * @var mixed */ protected $versionedData; /** - * + * @var int */ protected $version; /** + * @var \DateTime */ protected $snapshotDate; /** + * @var */ protected $path; diff --git a/Model/PageSnapshotInterface.php b/Model/PageSnapshotInterface.php index 67f94f002..62f42c6d4 100644 --- a/Model/PageSnapshotInterface.php +++ b/Model/PageSnapshotInterface.php @@ -7,18 +7,20 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; -use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface, - Networking\InitCmsBundle\Doctrine\Extensions\Versionable\ResourceVersionInterface; +use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface; +use Networking\InitCmsBundle\Doctrine\Extensions\Versionable\ResourceVersionInterface; /** + * Class PageSnapshotInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ -interface PageSnapshotInterface extends RouteReferrersReadInterface, ResourceVersionInterface{ +interface PageSnapshotInterface extends RouteReferrersReadInterface, ResourceVersionInterface +{ /** * @param $resourceId @@ -132,7 +134,6 @@ public function getContentRoute(); public function getOriginal(); - /** * @param $path */ diff --git a/Model/PageSnapshotManagerInterface.php b/Model/PageSnapshotManagerInterface.php index 1f6407f87..6471ee5e6 100644 --- a/Model/PageSnapshotManagerInterface.php +++ b/Model/PageSnapshotManagerInterface.php @@ -8,13 +8,12 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; -use Gedmo\Tree\RepositoryInterface; - /** + * Class PageSnapshotManagerInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface PageSnapshotManagerInterface diff --git a/Model/ResourceVersion.php b/Model/ResourceVersion.php index 73034b327..e988328b1 100644 --- a/Model/ResourceVersion.php +++ b/Model/ResourceVersion.php @@ -12,39 +12,43 @@ use Networking\InitCmsBundle\Doctrine\Extensions\Versionable\ResourceVersionInterface; use Networking\InitCmsBundle\Doctrine\Extensions\Versionable\VersionableInterface; -use Doctrine\ORM\Mapping as ORM; /** + * Class ResourceVersion + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick - * - * @ORM\Entity */ -class ResourceVersion implements ResourceVersionInterface +abstract class ResourceVersion implements ResourceVersionInterface { /** * @var integer $id * - * @ORM\Column(name="id", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; - /** @ORM\Column(type="string") */ + /** + * @var string + */ protected $resourceName; - /** @ORM\Column(type="integer") */ + /** + * @var int + */ protected $resourceId; - /** @ORM\Column(type="array") */ + /** + * @var + */ protected $versionedData; /** - * @ORM\Column(type="integer") + * @var int */ protected $version; - /** @ORM\Column(type="datetime") */ + /** + * @var \DateTime + */ protected $snapshotDate; /** diff --git a/Model/Tag.php b/Model/Tag.php index 814bffbf2..f2bcfa0f7 100644 --- a/Model/Tag.php +++ b/Model/Tag.php @@ -1,5 +1,4 @@ + * Class Tag + * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick */ -class Tag +abstract class Tag { /** * @var integer $id diff --git a/Model/Text.php b/Model/Text.php index 805c473cf..dfe348ad4 100644 --- a/Model/Text.php +++ b/Model/Text.php @@ -14,9 +14,9 @@ use Ibrows\Bundle\SonataAdminAnnotationBundle\Annotation as Sonata; /** - * Networking\InitCmsBundle\Entity\Content - * - * @author net working AG + * Class Text + * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick */ abstract class Text implements ContentInterface { @@ -43,7 +43,7 @@ abstract class Text implements ContentInterface protected $updatedAt; /** - * + * clone action, set id null */ public function __clone() { diff --git a/Model/TextInterface.php b/Model/TextInterface.php index c7ecf1846..d59058fc2 100644 --- a/Model/TextInterface.php +++ b/Model/TextInterface.php @@ -1,5 +1,4 @@ + * Class TextInterface + * @package Networking\InitCmsBundle\Model + * @author Yorkie Chadwick */ interface TextInterface { - /** * Get id * diff --git a/Model/UserInterface.php b/Model/UserInterface.php index dae911129..5303df653 100644 --- a/Model/UserInterface.php +++ b/Model/UserInterface.php @@ -8,10 +8,11 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; /** + * Class UserInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface UserInterface extends \Sonata\UserBundle\Model\UserInterface diff --git a/Model/UserManagerInterface.php b/Model/UserManagerInterface.php index 8503ffdfb..fd1d5512f 100644 --- a/Model/UserManagerInterface.php +++ b/Model/UserManagerInterface.php @@ -8,12 +8,13 @@ * file that was distributed with this source code. */ - namespace Networking\InitCmsBundle\Model; use Symfony\Component\Security\Core\User\UserProviderInterface; /** + * Class UserManagerInterface + * @package Networking\InitCmsBundle\Model * @author Yorkie Chadwick */ interface UserManagerInterface extends \FOS\UserBundle\Model\UserManagerInterface, UserProviderInterface diff --git a/NetworkingInitCmsBundle.php b/NetworkingInitCmsBundle.php index 0b82bc6fd..5a0f441a0 100644 --- a/NetworkingInitCmsBundle.php +++ b/NetworkingInitCmsBundle.php @@ -1,13 +1,29 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Networking\InitCmsBundle; -use Symfony\Component\HttpKernel\Bundle\Bundle, - Symfony\Component\DependencyInjection\ContainerBuilder, - Networking\InitCmsBundle\DependencyInjection\Compiler\OverrideServiceCompilerPass; +use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Networking\InitCmsBundle\DependencyInjection\Compiler\OverrideServiceCompilerPass; +/** + * Class NetworkingInitCmsBundle + * @package Networking\InitCmsBundle + * @author Yorkie Chadwick + */ class NetworkingInitCmsBundle extends Bundle { + /** + * @param ContainerBuilder $container + */ public function build(ContainerBuilder $container) { parent::build($container); @@ -15,6 +31,9 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new OverrideServiceCompilerPass()); } + /** + * @return string + */ public function getParent() { return 'SonataUserBundle'; diff --git a/Resources/config/admin_mongodb.xml b/Resources/config/admin_mongodb.xml new file mode 100644 index 000000000..f24052725 --- /dev/null +++ b/Resources/config/admin_mongodb.xml @@ -0,0 +1,92 @@ + + + + + + + + %networking_init_cms.admin.page.class% + NetworkingInitCmsBundle:PageAdmin + + PageAdmin + + + %networking_init_cms.page.languages% + + + + + + + + + + + Networking\InitCmsBundle\Document\LayoutBlock + NetworkingInitCmsBundle:CRUD + + PageAdmin + + + + + + + + Networking\InitCmsBundle\Document\MenuItem + NetworkingInitCmsBundle:MenuItemAdmin + + MenuItemAdmin + + + %networking_init_cms.page.languages% + + + + Networking\InitCmsBundle\Document\MenuItem + Networking\InitCmsBundle\Document\MenuItem + + + + + + + + + Networking\InitCmsBundle\Document\HelpText + SonataAdminBundle:CRUD + + HelpTextAdmin + + + %networking_init_cms.page.languages% + + + + + + + + Networking\InitCmsBundle\Document\Tag + NetworkingInitCmsBundle:CRUD + + TagAdmin + + + + + + + \ No newline at end of file diff --git a/Resources/config/admin_mongodb.yml b/Resources/config/admin_mongodb.yml deleted file mode 100644 index 92f618be8..000000000 --- a/Resources/config/admin_mongodb.yml +++ /dev/null @@ -1,56 +0,0 @@ -services: -# Page Admin Contoller - networking_init_cms.page.admin.helper: - class: Networking\InitCmsBundle\Admin\PageAdminHelper - arguments: - - @sonata.admin.pool - - networking_init_cms.page.admin.page: - class: Networking\InitCmsBundle\Admin\Document\PageAdmin - arguments: [null, %networking_init_cms.admin.page.class%, NetworkingInitCmsBundle:PageAdmin] - calls: - - [setTranslationDomain, [PageAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - - [setPageManager, [@networking_init_cms.page_manager]] - tags: - - { name: sonata.admin, manager_type: doctrine_mongodb, label: Pages, label_translator_strategy: sonata.admin.label.strategy.underscore, persist_filters: true } - -# Tag Admin Controller - networking_init_cms.page.admin.tag: - class: Networking\InitCmsBundle\Admin\TagAdmin - arguments: [null, Networking\InitCmsBundle\Document\Tag, NetworkingInitCmsBundle:CRUD] - calls: - - [setTranslationDomain, [TagAdmin]] - tags: - - { name: sonata.admin, manager_type: doctrine_mongodb, label: Tags, label_translator_strategy: sonata.admin.label.strategy.underscore} - -# HelpText Admin Controller - networking_init_cms.page.admin.help_text: - class: Networking\InitCmsBundle\Admin\HelpTextAdmin - arguments: [null, Networking\InitCmsBundle\Document\HelpText, SonataAdminBundle:CRUD] - calls: - - [setTranslationDomain, [HelpTextAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - tags: - - { name: sonata.admin, manager_type: doctrine_mongodb, label: 'Help Text', label_translator_strategy: sonata.admin.label.strategy.underscore} - - -# Layout Block Admin Controller - networking_init_cms.page.admin.layout_block: - class: Networking\InitCmsBundle\Admin\LayoutBlockAdmin - arguments: [null, %networking_init_cms.admin.layout_block.class%, SonataAdminBundle:CRUD] - calls: - - [setTranslationDomain, [PageAdmin]] - tags: - - { name: sonata.admin, manager_type: doctrine_mongodb, label: Content, label_translator_strategy: sonata.admin.label.strategy.underscore } - -# Menu Admin Controller - networking_init_cms.menu.admin.menu_item: - class: Networking\InitCmsBundle\Admin\MenuItemAdmin - arguments: [null, Networking\InitCmsBundle\Document\MenuItem, NetworkingInitCmsBundle:MenuItemAdmin] - calls: - - [setTranslationDomain, [MenuItemAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - - [setSubClasses, [{"menu": Networking\InitCmsBundle\Document\MenuItem, "menu item": Networking\InitCmsBundle\Document\MenuItem}]] - tags: - - { name: sonata.admin, manager_type: doctrine_mongodb, icon: happy, label: "Menus", label_translator_strategy: sonata.admin.label.strategy.underscore} diff --git a/Resources/config/admin_orm.xml b/Resources/config/admin_orm.xml new file mode 100644 index 000000000..b7c4bf234 --- /dev/null +++ b/Resources/config/admin_orm.xml @@ -0,0 +1,92 @@ + + + + + + + + %networking_init_cms.admin.page.class% + NetworkingInitCmsBundle:PageAdmin + + PageAdmin + + + %networking_init_cms.page.languages% + + + + + + + + + + + Networking\InitCmsBundle\Entity\LayoutBlock + NetworkingInitCmsBundle:CRUD + + PageAdmin + + + + + + + + Networking\InitCmsBundle\Entity\MenuItem + NetworkingInitCmsBundle:MenuItemAdmin + + MenuItemAdmin + + + %networking_init_cms.page.languages% + + + + Networking\InitCmsBundle\Entity\MenuItem + Networking\InitCmsBundle\Entity\MenuItem + + + + + + + + + Networking\InitCmsBundle\Entity\HelpText + SonataAdminBundle:CRUD + + HelpTextAdmin + + + %networking_init_cms.page.languages% + + + + + + + + Networking\InitCmsBundle\Entity\Tag + NetworkingInitCmsBundle:CRUD + + TagAdmin + + + + + + + \ No newline at end of file diff --git a/Resources/config/admin_orm.yml b/Resources/config/admin_orm.yml deleted file mode 100644 index 4f4f73be4..000000000 --- a/Resources/config/admin_orm.yml +++ /dev/null @@ -1,57 +0,0 @@ -services: -# Page Admin Contoller - networking_init_cms.page.admin.helper: - class: Networking\InitCmsBundle\Admin\PageAdminHelper - arguments: - - @sonata.admin.pool - - networking_init_cms.page.admin.page: - class: Networking\InitCmsBundle\Admin\Entity\PageAdmin - arguments: [null, %networking_init_cms.admin.page.class%, NetworkingInitCmsBundle:PageAdmin] - calls: - - [setTranslationDomain, [PageAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - - [setPageManager, [@networking_init_cms.page_manager]] - tags: - - { name: sonata.admin, manager_type: orm, label: Pages, label_translator_strategy: sonata.admin.label.strategy.underscore, persist_filters: true } - -# Tag Admin Controller - networking_init_cms.page.admin.tag: - class: Networking\InitCmsBundle\Admin\TagAdmin - arguments: [null, Networking\InitCmsBundle\Entity\Tag, NetworkingInitCmsBundle:CRUD] - calls: - - [setTranslationDomain, [TagAdmin]] - tags: - - { name: sonata.admin, manager_type: orm, label: Tags, label_translator_strategy: sonata.admin.label.strategy.underscore} - -# HelpText Admin Controller - networking_init_cms.page.admin.help_text: - class: Networking\InitCmsBundle\Admin\Entity\HelpTextAdmin - arguments: [null, Networking\InitCmsBundle\Entity\HelpText, SonataAdminBundle:CRUD] - calls: - - [setTranslationDomain, [HelpTextAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - tags: - - { name: sonata.admin, manager_type: orm, label: 'Help Text', label_translator_strategy: sonata.admin.label.strategy.underscore} - - -# Layout Block Admin Controller - networking_init_cms.page.admin.layout_block: - class: Networking\InitCmsBundle\Admin\Entity\LayoutBlockAdmin - arguments: [null, Networking\InitCmsBundle\Entity\LayoutBlock, SonataAdminBundle:CRUD] - calls: - - [setTranslationDomain, [PageAdmin]] - tags: - - { name: sonata.admin, manager_type: orm, label: Content, label_translator_strategy: sonata.admin.label.strategy.underscore } - -# Menu Admin Controller - networking_init_cms.menu.admin.menu_item: - class: Networking\InitCmsBundle\Admin\Entity\MenuItemAdmin - arguments: [null, Networking\InitCmsBundle\Entity\MenuItem, NetworkingInitCmsBundle:MenuItemAdmin] - calls: - - [setTranslationDomain, [MenuItemAdmin]] - - [setLanguages, [%networking_init_cms.page.languages%]] - - [setSubClasses, [{"menu": Networking\InitCmsBundle\Entity\MenuItem, "menu item": Networking\InitCmsBundle\Entity\MenuItem}]] - tags: - - { name: sonata.admin, manager_type: orm, icon: happy, label: "Menus", label_translator_strategy: sonata.admin.label.strategy.underscore} - diff --git a/Resources/config/blocks.xml b/Resources/config/blocks.xml new file mode 100644 index 000000000..72669acb5 --- /dev/null +++ b/Resources/config/blocks.xml @@ -0,0 +1,28 @@ + + + + + + networking_init_cms.block_translatable + + + + + + networking_init_cms.block_online_users + + + + + + + networking_init_cms.block_pages + + + + + + + \ No newline at end of file diff --git a/Resources/config/blocks_mongodb.yml b/Resources/config/blocks_mongodb.yml deleted file mode 100644 index 094f26e67..000000000 --- a/Resources/config/blocks_mongodb.yml +++ /dev/null @@ -1,18 +0,0 @@ -services: - networking_init_cms.block.service.translatable_text: - class: Networking\InitCmsBundle\Block\TranslatableTextBlockService - arguments: ["networking_initcms_block_translatable", @templating] - tags: - - { name: sonata.block} - - networking_init_cms.block.service.online_users: - class: Networking\InitCmsBundle\Block\OnlineUsersBlockService - arguments: ["networking_initcms_block_online_users", @templating, @networking_init_cms.user_manager] - tags: - - { name: sonata.block} - - networking_init_cms.block.service.pages: - class: Networking\InitCmsBundle\Block\PagesBlockService - arguments: ["networking_initcms_block_pages", @templating, @networking_init_cms.page_manager] - tags: - - { name: sonata.block} diff --git a/Resources/config/blocks_orm.yml b/Resources/config/blocks_orm.yml deleted file mode 100644 index 094f26e67..000000000 --- a/Resources/config/blocks_orm.yml +++ /dev/null @@ -1,18 +0,0 @@ -services: - networking_init_cms.block.service.translatable_text: - class: Networking\InitCmsBundle\Block\TranslatableTextBlockService - arguments: ["networking_initcms_block_translatable", @templating] - tags: - - { name: sonata.block} - - networking_init_cms.block.service.online_users: - class: Networking\InitCmsBundle\Block\OnlineUsersBlockService - arguments: ["networking_initcms_block_online_users", @templating, @networking_init_cms.user_manager] - tags: - - { name: sonata.block} - - networking_init_cms.block.service.pages: - class: Networking\InitCmsBundle\Block\PagesBlockService - arguments: ["networking_initcms_block_pages", @templating, @networking_init_cms.page_manager] - tags: - - { name: sonata.block} diff --git a/Resources/config/cms/sonata_admin.yml b/Resources/config/cms/sonata_admin.yml index 0f85042b6..5b51b2f08 100644 --- a/Resources/config/cms/sonata_admin.yml +++ b/Resources/config/cms/sonata_admin.yml @@ -41,21 +41,21 @@ sonata_admin: groups: pages: label: "pages.label" - items: [networking_init_cms.page.admin.page] + items: [networking_init_cms.admin.page] translation: label: "group.translation" items: [ibrows_sonata_translation.admin.orm] menu: label: "menu.label" - items: [ networking_init_cms.menu.admin.menu_item] + items: [ networking_init_cms.admin.menu_item] media: label: "sonata_media" - items: [sonata.media.admin.media, sonata.media.admin.gallery, networking_init_cms.page.admin.tag] + items: [sonata.media.admin.media, sonata.media.admin.gallery, networking_init_cms.admin.tag] users: label: "sonata_user" items: [sonata.user.admin.user, sonata.user.admin.group] help_text: label: "help_text.label" - items: [networking_init_cms.page.admin.help_text] + items: [networking_init_cms.admin.help_text] diff --git a/Resources/config/doctrine/BasePage.orm.yml b/Resources/config/doctrine/BasePage.orm.yml index be5800a5e..0d175c9e4 100644 --- a/Resources/config/doctrine/BasePage.orm.yml +++ b/Resources/config/doctrine/BasePage.orm.yml @@ -37,6 +37,8 @@ Networking\InitCmsBundle\Entity\BasePage: type: integer column: lvl nullable: true + gedmo: + 0: treeLevel metaKeyword: type: string length: 255 diff --git a/Resources/config/doctrine/MenuItem.orm.xml b/Resources/config/doctrine/MenuItem.orm.xml deleted file mode 100644 index ff0e0d086..000000000 --- a/Resources/config/doctrine/MenuItem.orm.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Resources/config/doctrine/AdminSettings.mongodb.xml b/Resources/config/doctrine/mongodb/AdminSettings.mongodb.xml similarity index 100% rename from Resources/config/doctrine/AdminSettings.mongodb.xml rename to Resources/config/doctrine/mongodb/AdminSettings.mongodb.xml diff --git a/Resources/config/doctrine/BaseLayoutBlock.mongodb.xml b/Resources/config/doctrine/mongodb/BaseLayoutBlock.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BaseLayoutBlock.mongodb.xml rename to Resources/config/doctrine/mongodb/BaseLayoutBlock.mongodb.xml diff --git a/Resources/config/doctrine/BaseMenuItem.mongodb.xml b/Resources/config/doctrine/mongodb/BaseMenuItem.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BaseMenuItem.mongodb.xml rename to Resources/config/doctrine/mongodb/BaseMenuItem.mongodb.xml diff --git a/Resources/config/doctrine/BasePage.mongodb.xml b/Resources/config/doctrine/mongodb/BasePage.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BasePage.mongodb.xml rename to Resources/config/doctrine/mongodb/BasePage.mongodb.xml diff --git a/Resources/config/doctrine/BasePageSnapshot.mongodb.xml b/Resources/config/doctrine/mongodb/BasePageSnapshot.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BasePageSnapshot.mongodb.xml rename to Resources/config/doctrine/mongodb/BasePageSnapshot.mongodb.xml diff --git a/Resources/config/doctrine/BaseText.mongodb.xml b/Resources/config/doctrine/mongodb/BaseText.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BaseText.mongodb.xml rename to Resources/config/doctrine/mongodb/BaseText.mongodb.xml diff --git a/Resources/config/doctrine/BaseUser.mongodb.xml b/Resources/config/doctrine/mongodb/BaseUser.mongodb.xml similarity index 100% rename from Resources/config/doctrine/BaseUser.mongodb.xml rename to Resources/config/doctrine/mongodb/BaseUser.mongodb.xml diff --git a/Resources/config/doctrine/ContentRoute.mongodb.xml b/Resources/config/doctrine/mongodb/ContentRoute.mongodb.xml similarity index 100% rename from Resources/config/doctrine/ContentRoute.mongodb.xml rename to Resources/config/doctrine/mongodb/ContentRoute.mongodb.xml diff --git a/Resources/config/doctrine/Gallery.mongodb.xml b/Resources/config/doctrine/mongodb/Gallery.mongodb.xml similarity index 100% rename from Resources/config/doctrine/Gallery.mongodb.xml rename to Resources/config/doctrine/mongodb/Gallery.mongodb.xml diff --git a/Resources/config/doctrine/GalleryHasMedia.mongodb.xml b/Resources/config/doctrine/mongodb/GalleryHasMedia.mongodb.xml similarity index 100% rename from Resources/config/doctrine/GalleryHasMedia.mongodb.xml rename to Resources/config/doctrine/mongodb/GalleryHasMedia.mongodb.xml diff --git a/Resources/config/doctrine/GalleryView.mongodb.xml b/Resources/config/doctrine/mongodb/GalleryView.mongodb.xml similarity index 100% rename from Resources/config/doctrine/GalleryView.mongodb.xml rename to Resources/config/doctrine/mongodb/GalleryView.mongodb.xml diff --git a/Resources/config/doctrine/Group.mongodb.xml b/Resources/config/doctrine/mongodb/Group.mongodb.xml similarity index 100% rename from Resources/config/doctrine/Group.mongodb.xml rename to Resources/config/doctrine/mongodb/Group.mongodb.xml diff --git a/Resources/config/doctrine/HelpText.mongodb.xml b/Resources/config/doctrine/mongodb/HelpText.mongodb.xml similarity index 100% rename from Resources/config/doctrine/HelpText.mongodb.xml rename to Resources/config/doctrine/mongodb/HelpText.mongodb.xml diff --git a/Resources/config/doctrine/Media.mongodb.xml b/Resources/config/doctrine/mongodb/Media.mongodb.xml similarity index 100% rename from Resources/config/doctrine/Media.mongodb.xml rename to Resources/config/doctrine/mongodb/Media.mongodb.xml diff --git a/Resources/config/doctrine/Page.mongodb.xml.skeleton b/Resources/config/doctrine/mongodb/Page.mongodb.xml.skeleton similarity index 100% rename from Resources/config/doctrine/Page.mongodb.xml.skeleton rename to Resources/config/doctrine/mongodb/Page.mongodb.xml.skeleton diff --git a/Resources/config/doctrine/ResourceVersion.mongodb.xml b/Resources/config/doctrine/mongodb/ResourceVersion.mongodb.xml similarity index 100% rename from Resources/config/doctrine/ResourceVersion.mongodb.xml rename to Resources/config/doctrine/mongodb/ResourceVersion.mongodb.xml diff --git a/Resources/config/doctrine/Tag.mongodb.xml b/Resources/config/doctrine/mongodb/Tag.mongodb.xml similarity index 100% rename from Resources/config/doctrine/Tag.mongodb.xml rename to Resources/config/doctrine/mongodb/Tag.mongodb.xml diff --git a/Resources/config/doctrine/Text.mongodb.xml b/Resources/config/doctrine/mongodb/Text.mongodb.xml similarity index 100% rename from Resources/config/doctrine/Text.mongodb.xml rename to Resources/config/doctrine/mongodb/Text.mongodb.xml diff --git a/Resources/config/doctrine/User.mongodb.xml.skeleton b/Resources/config/doctrine/mongodb/User.mongodb.xml.skeleton similarity index 100% rename from Resources/config/doctrine/User.mongodb.xml.skeleton rename to Resources/config/doctrine/mongodb/User.mongodb.xml.skeleton diff --git a/Resources/config/doctrine_mongodb.xml b/Resources/config/doctrine_mongodb.xml index 2bb2dae2b..54ec7f222 100644 --- a/Resources/config/doctrine_mongodb.xml +++ b/Resources/config/doctrine_mongodb.xml @@ -91,7 +91,7 @@ - + %networking_init_cms.page.content_types% diff --git a/Resources/config/doctrine_orm.xml b/Resources/config/doctrine_orm.xml index 98a2e9479..0243a04d4 100644 --- a/Resources/config/doctrine_orm.xml +++ b/Resources/config/doctrine_orm.xml @@ -91,7 +91,7 @@ - + %networking_init_cms.page.content_types% diff --git a/Resources/config/ext_admin_mongodb.xml b/Resources/config/ext_admin_mongodb.xml index ebd4a535c..06351a9a9 100644 --- a/Resources/config/ext_admin_mongodb.xml +++ b/Resources/config/ext_admin_mongodb.xml @@ -11,7 +11,7 @@ MediaAdmin - Networking\InitCmsBundle\Admin\GalleryAdmin + Networking\InitCmsBundle\Admin\Document\GalleryAdmin NetworkingInitCmsBundle:GalleryAdmin diff --git a/Resources/config/ext_admin_orm.xml b/Resources/config/ext_admin_orm.xml index de9fb8d91..390e06eec 100644 --- a/Resources/config/ext_admin_orm.xml +++ b/Resources/config/ext_admin_orm.xml @@ -11,7 +11,7 @@ MediaAdmin - Networking\InitCmsBundle\Admin\GalleryAdmin + Networking\InitCmsBundle\Admin\Entity\GalleryAdmin NetworkingInitCmsBundle:GalleryAdmin diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 25f0acd07..d982a9e04 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -22,6 +22,10 @@ + + + + diff --git a/Resources/translations/HelpTextAdmin.de.xliff b/Resources/translations/HelpTextAdmin.de.xliff index dc3838bf6..bddacf579 100644 --- a/Resources/translations/HelpTextAdmin.de.xliff +++ b/Resources/translations/HelpTextAdmin.de.xliff @@ -53,8 +53,8 @@ help_title Help for: %admin_title% %action% - - networking_init_cms.page.admin.page.edit + + networking_init_cms.admin.page.edit Page edit @@ -76,12 +76,12 @@ - - networking_init_cms.page.admin.page + + networking_init_cms.admin.page Pages - - networking_init_cms.menu.admin.menu_item + + networking_init_cms.admin.menu_item Menu @@ -178,12 +178,12 @@ - - networking_init_cms.page.admin.page.list.title + + networking_init_cms.admin.page.list.title Seiten-Übersicht - - networking_init_cms.page.admin.page.list.text + + networking_init_cms.admin.page.list.text Eine Seite ist ein Schlüsselbaustein für die Website. Auf einer Seite können Sie Ihren Content und seine Position im Layout hinzufügen oder ändern. Unter „Seiten" im CMS finden Sie eine Liste all Ihrer Seiten. Am Listenanfang können Sie Seiten filtern und suchen. Es gibt auch eine hervorstehende Schaltfläche zum Hinzufügen von neuen Seiten. Am Listenende finden Sie Massenfunktionalitäten, um schnelle Änderungen auf mehrere Seiten auf einmal anzuwenden.

@@ -231,12 +231,12 @@ ]]>
- - networking_init_cms.page.admin.page.create.title + + networking_init_cms.admin.page.create.title Neue Seite hinzufügen - - networking_init_cms.page.admin.page.create.text + + networking_init_cms.admin.page.create.text Klicken Sie zuerst im Abschnitt "Seiten" des CMS auf die Schaltfläche "+ Seite hinzufügen". Alle mit "*" gekennzeichneten Felder sind Pflichtfelder, die anderen sind optional. In der folgenden Liste werden alle Felder erläutert.

@@ -273,12 +273,12 @@ ]]>
- - networking_init_cms.page.admin.page.edit.title + + networking_init_cms.admin.page.edit.title Seite bearbeiten - - networking_init_cms.page.admin.page.edit.text + + networking_init_cms.admin.page.edit.text Das Editierformular umfasst mehrere Bereiche. Unter dem Seitentitel sehen Sie den Content-Bereich mit einem oder mehreren Layout-Containern. Auf der rechten Seite finden Sie zusätzliche Informationen und Aktionen für die Seite.

@@ -316,12 +316,12 @@ - - networking_init_cms.menu.admin.menu_item.navigation.title + + networking_init_cms.admin.menu_item.navigation.title Menü-Übersicht - - networking_init_cms.menu.admin.menu_item.navigation.text + + networking_init_cms.admin.menu_item.navigation.text Ein Menü bietet eine Navigation, damit andere leicht auf Ihren Content zugreifen können. Jedes Menü wird durch eine Registerkarte dargestellt, das ausgewählte Menü wird hell hervorgehoben. Unter dem hell hervorgehobenen Menü sehen Sie alle Optionen und die Liste der Menüelemente. Die Menüelement-Liste zeigt Informationen über jeden Menüpunkt an und bietet die Funktionen zum Verschieben (Umsortieren), Bearbeiten und Löschen jedes Punkts an. Über den Registerkarten können Sie die Menüs nach Sprache filtern.

@@ -343,12 +343,12 @@ Ein Menü gehört nur zur ausgewählten Sprache. Somit hat jede Sprache ihre eigenen Menüs. Dadurch steht Ihnen in jeder Sprache ein separater Menü-Baum zur Verfügung.

]]>
- - networking_init_cms.menu.admin.menu_item.create.title + + networking_init_cms.admin.menu_item.create.title Neues Menüelement hinzufügen - - networking_init_cms.menu.admin.menu_item.create.text + + networking_init_cms.admin.menu_item.create.text In der Menü-Übersicht finden Sie die blaue Schaltfläche "+ Element hinzufügen". Wenn Sie sie anklicken, wird ein neues Menüelement in dem aktuell ausgewählten Menü angelegt.

@@ -446,12 +446,12 @@ ​Klicken Sie "+ Neue hinzufügen" an, um vorhandene Medien hinzuzufügen, oder laden Sie neue Medien direkt hoch. Sie können bei Bedarf auch Medien aus der Galerie löschen. Sie können jederzeit darauf zurückkommen und Medien für eine Galerie hinzufügen oder ändern.

]]>
- - networking_init_cms.page.admin.tag.list.title + + networking_init_cms.admin.tag.list.title Medien-Tag (Markierung) - - networking_init_cms.page.admin.tag.list.text + + networking_init_cms.admin.tag.list.text Ein Medien-Tag ist ein Wort, Begriff oder Ausdruck, denn Sie frei erstellen und mit Ihren Medienelementen verbinden können. Medien-Tags können dazu verwendet werden, alle in der Medien-Bibliothek verwalteten Medien zu filtern. So können Sie schnell und leicht durch eine Vielzahl von Medien navigieren.

diff --git a/Resources/translations/HelpTextAdmin.en.xliff b/Resources/translations/HelpTextAdmin.en.xliff index 62d39c229..9545411ed 100644 --- a/Resources/translations/HelpTextAdmin.en.xliff +++ b/Resources/translations/HelpTextAdmin.en.xliff @@ -53,8 +53,8 @@ help_title Help for: %admin_title% %action%
- - networking_init_cms.page.admin.page.edit + + networking_init_cms.admin.page.edit Page edit @@ -76,12 +76,12 @@ - - networking_init_cms.page.admin.page + + networking_init_cms.admin.page Pages - - networking_init_cms.menu.admin.menu_item + + networking_init_cms.admin.menu_item Menu @@ -178,12 +178,12 @@ - - networking_init_cms.page.admin.page.list.title + + networking_init_cms.admin.page.list.title Pages overview - - networking_init_cms.page.admin.page.list.text + + networking_init_cms.admin.page.list.text A page is a key building block for the website. On a page you can add or change your content and its position in the layout. Under "Pages" in the CMS you see a list of all your pages. On top of the list you can filter and search pages. There is also a prominent button for adding new Pages. On the bottom of the list you find bulk actions to apply quick changes to multiple pages at once.

@@ -231,12 +231,12 @@ ]]>
- - networking_init_cms.page.admin.page.create.title + + networking_init_cms.admin.page.create.title Add a new page - - networking_init_cms.page.admin.page.create.text + + networking_init_cms.admin.page.create.text Begin by clicking the "+ Add Page" button in the "Pages" section of the CMS. All fields marked with "*" are mandatory, the others are optional. The following list explains all fields.

@@ -273,12 +273,12 @@ ]]>
- - networking_init_cms.page.admin.page.edit.title + + networking_init_cms.admin.page.edit.title Edit a page - - networking_init_cms.page.admin.page.edit.text + + networking_init_cms.admin.page.edit.text The Edit Form has multiple areas. Below the page title you see the content area with one or more layout containers. On the right side you find additional information and actions for the page.

@@ -316,12 +316,12 @@ - - networking_init_cms.menu.admin.menu_item.navigation.title + + networking_init_cms.admin.menu_item.navigation.title Menu overview - - networking_init_cms.menu.admin.menu_item.navigation.text + + networking_init_cms.admin.menu_item.navigation.text A menu provides a navigation to make your content easily accessible by others. Each menu is represented by a tab, the selected menu is highlighted. Below the highlighted menu you will see all the options and the list of menu items. The menu item list displays information about each menu point and offers the functions to move (reorder), edit and delete each point. On top of the tabs you can filter the menus by language.

@@ -343,12 +343,12 @@ A menu belongs to the selected language only. Thus every language has it's own menus. This allows you to have a separate menu tree in each language.

]]>
- - networking_init_cms.menu.admin.menu_item.create.title + + networking_init_cms.admin.menu_item.create.title Add a new menu item - - networking_init_cms.menu.admin.menu_item.create.text + + networking_init_cms.admin.menu_item.create.text In the menu overview you will find the blue button "+ Add Item", clicking it will create a new menu item in the current selected menu.

@@ -446,12 +446,12 @@ ​Click "+ Add new" to add existing media or directly upload new media. You can even delete media from the gallery if necessary. You can come back any time to add or change media for a gallery.

]]>
- - networking_init_cms.page.admin.tag.list.title + + networking_init_cms.admin.tag.list.title Media Tag - - networking_init_cms.page.admin.tag.list.text + + networking_init_cms.admin.tag.list.text A media tag is a word or phrase, which you can freely create and associate to your media items. Media tags can then be used to filter all the media that is managed in the media library, you can then use the media tags to filter and find your way through large amounts of media quickly and easily

diff --git a/Security/Acl/Permission/AdminPermissionMap.php b/Security/Acl/Permission/AdminPermissionMap.php index 66f3459ae..47a4e3392 100644 --- a/Security/Acl/Permission/AdminPermissionMap.php +++ b/Security/Acl/Permission/AdminPermissionMap.php @@ -1,5 +1,4 @@ + * Class NetworkingHelperExtension + * @package Networking\InitCmsBundle\Twig\Extension + * @author Yorkie Chadwick */ class NetworkingHelperExtension extends \Twig_Extension implements ContainerAwareInterface { @@ -42,7 +44,6 @@ class NetworkingHelperExtension extends \Twig_Extension implements ContainerAwar protected $collectedHtml = array(); - /** * Sets the Container. * @@ -55,6 +56,15 @@ public function setContainer(ContainerInterface $container = null) $this->container = $container; } + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + public function getName() + { + return 'networking_init_cms_helper'; + } /** @@ -139,14 +149,14 @@ public function getFunctions() * Returns an HTML block for output in the frontend * * @param $template - * @param $class - * @param $id - * @return mixed + * @param LayoutBlockInterface $layoutBlock + * @param array $params + * @return string */ public function renderInitCmsBlock($template, LayoutBlockInterface $layoutBlock, $params = array()) { /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */ - $layoutBlockAdmin = $this->getService('networking_init_cms.page.admin.layout_block'); + $layoutBlockAdmin = $this->getService('networking_init_cms.admin.layout_block'); if (!$serializedContent = $layoutBlock->getSnapshotContent()) { // Draft View $contentItem = $layoutBlockAdmin->getModelManager()->find( @@ -186,7 +196,7 @@ public function renderInitCmsBlock($template, LayoutBlockInterface $layoutBlock, public function renderInitcmsAdminBlock(LayoutBlockInterface $layoutBlock) { /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */ - $layoutBlockAdmin = $this->getService('networking_init_cms.page.admin.layout_block'); + $layoutBlockAdmin = $this->getService('networking_init_cms.admin.layout_block'); if ($layoutBlock->getObjectId()) { // Draft View $contentItem = $layoutBlockAdmin->getModelManager()->find( @@ -217,7 +227,7 @@ public function renderInitcmsAdminBlock(LayoutBlockInterface $layoutBlock) public function renderContentTypeName(LayoutBlockInterface $layoutBlock) { /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */ - $layoutBlockAdmin = $this->getService('networking_init_cms.page.admin.layout_block'); + $layoutBlockAdmin = $this->getService('networking_init_cms.admin.layout_block'); if ($layoutBlock->getObjectId()) { $contentItem = $layoutBlockAdmin->getModelManager()->find( $layoutBlock->getClassType(), @@ -319,7 +329,6 @@ public function isAdminGroupActive(array $group, $adminCode = '') } } - return $active; } @@ -397,6 +406,9 @@ public function getInitcmsAdminIconPath( /** * Modifies a string to remove all non ASCII characters and spaces. + * + * @param $text + * @return mixed|string */ static public function slugify($text) { @@ -425,6 +437,8 @@ static public function slugify($text) } /** + * returns the locale of the current admin user + * * @param \Sonata\AdminBundle\Admin\AdminInterface $admin * @return mixed|string */ @@ -500,8 +514,8 @@ public function getShortName($class) } /** - * - * @return string + * @param $class + * @return mixed */ public function getBundleShortName($class) { @@ -778,7 +792,6 @@ public function addToBottomEnd() $data = \ob_get_clean(); $this->captureLock = false; $this->addToCollectedHtml($data); -// return true; } /** @@ -787,7 +800,6 @@ public function addToBottomEnd() protected function addToCollectedHtml($data) { $this->collectedHtml[] = $data; -// return $this; } /** @@ -798,16 +810,6 @@ public function render() return implode("\n ", $this->collectedHtml) . "\n"; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'networking_init_cms_helper'; - } - /** * Cuts a string to the length of $length and replaces the last characters * with the ellipsis if the text is longer than length. @@ -1042,7 +1044,7 @@ public function getPageUrl(PageInterface $page) if (!$page->getContentRoute()) { /** @var \Sonata\AdminBundle\Admin\AdminInterface $pageAdmin */ - $pageAdmin = $this->getService('networking_init_cms.page.admin.page'); + $pageAdmin = $this->getService('networking_init_cms.admin.page'); /** @var \Networking\InitCmsBundle\Model\PageSnapshotManagerInterface $per */ $per = $this->getDoctrine()->getRepository('NetworkingInitCmsBundle:PageSnapshot'); $pageSnapshots = $per->findSnapshotByPageId($page->getId()); @@ -1080,7 +1082,7 @@ protected function getDoctrine() { $db_driver = $this->getParameter('networking_init_cms.db_driver'); - switch($db_driver){ + switch ($db_driver) { case 'orm': return $this->getService('doctrine'); break; diff --git a/Twig/Node/JSNode.php b/Twig/Node/JSNode.php index 7fb9119af..cf7bf95bf 100644 --- a/Twig/Node/JSNode.php +++ b/Twig/Node/JSNode.php @@ -1,5 +1,4 @@ + * Class JSNode + * @package Networking\InitCmsBundle\Twig\Node + * @author Yorkie Chadwick */ class JSNode extends \Twig_Node { /** - * @param \Twig_NodeInterface $method + * @param \Twig_Node $method * @param array $lineno * @param null $tag */ diff --git a/Twig/TokenParser/JSTokenParser.php b/Twig/TokenParser/JSTokenParser.php index 2cbc98b20..ef91b8dfc 100644 --- a/Twig/TokenParser/JSTokenParser.php +++ b/Twig/TokenParser/JSTokenParser.php @@ -1,5 +1,4 @@ + * Class JSTokenParser + * @package Networking\InitCmsBundle\Twig\TokenParser + * @author Yorkie Chadwick */ class JSTokenParser extends Twig_TokenParser { diff --git a/Validator/Constraints/Path.php b/Validator/Constraints/Path.php index b12868663..4a6eace94 100644 --- a/Validator/Constraints/Path.php +++ b/Validator/Constraints/Path.php @@ -1,5 +1,4 @@ - * @author Bernhard Schussek + * @package Networking\InitCmsBundle\Validator\Constraints + * @author Yorkie Chadwick */ class Path extends Constraint { diff --git a/Validator/Constraints/PathValidator.php b/Validator/Constraints/PathValidator.php index 3390ec071..80c073cde 100644 --- a/Validator/Constraints/PathValidator.php +++ b/Validator/Constraints/PathValidator.php @@ -1,5 +1,4 @@ - * @author Bernhard Schussek - * + * Class PathValidator + * @package Networking\InitCmsBundle\Validator\Constraints + * @author Yorkie Chadwick */ class PathValidator extends ConstraintValidator { diff --git a/Validator/Constraints/UniqueURL.php b/Validator/Constraints/UniqueURL.php index f12d92ef5..4c74ee943 100644 --- a/Validator/Constraints/UniqueURL.php +++ b/Validator/Constraints/UniqueURL.php @@ -1,5 +1,4 @@ + * Class UniqueURL * * @Annotation + * + * @package Networking\InitCmsBundle\Validator\Constraints + * @author Yorkie Chadwick */ class UniqueURL extends Constraint { @@ -33,6 +36,9 @@ public function validatedBy() return 'unique_url_validator'; } + /** + * @return array|string + */ public function getTargets() { return self::CLASS_CONSTRAINT; diff --git a/Validator/Constraints/UniqueURLValidator.php b/Validator/Constraints/UniqueURLValidator.php index 700bf68f7..ef805ba6b 100644 --- a/Validator/Constraints/UniqueURLValidator.php +++ b/Validator/Constraints/UniqueURLValidator.php @@ -1,5 +1,4 @@ + * Class UniqueURLValidator + * @package Networking\InitCmsBundle\Validator\Constraints + * @author Yorkie Chadwick */ class UniqueURLValidator extends ConstraintValidator {