Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.

Sysmoh excel du ss wag#115

Open
nuffer wants to merge 5 commits intomasterfrom
sysmoh_excel_du_ssWag
Open

Sysmoh excel du ss wag#115
nuffer wants to merge 5 commits intomasterfrom
sysmoh_excel_du_ssWag

Conversation

@nuffer
Copy link
Collaborator

@nuffer nuffer commented Jan 18, 2017

  • Mise en place de l'export des list pour csv et xlsx.
  • mise à jours des liste en virant ListRender (contenu dans les listes maintenant)
  • ajouter du container dans toutes les listes

resolve #79

@nuffer nuffer requested a review from mullerch January 18, 2017 21:36
$reflectionProp = new \ReflectionProperty($entityClass, $property);
$relation = $reader->getPropertyAnnotation($reflectionProp, 'AppBundle\\Annotations\\Annotation\\Excel');

if($relation) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A supprimer ?

return ResponseFactory::streamFile($response,$this->name.'.csv',$type);

case self::FORMAT_EXPORT_XLSX:
$export = new ListToExcel($this->container->getParameter('cache_temporary_documents_dir'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca devrait être un service je pense

/**
* @return String
*/
public function getCssClass()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca devrait plutot être un array, du genre addCssClass($class) et à la fin on fait un implode(' ', $this->cssClass), ca permet d'en ajouter à plusieurs endroits

{
public static function hydrateObject($entityClass, $data)
{
$reader = new AnnotationReader();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plutot que de créer une nouvelle instance, il est dispo en service ca évite d'en recréer un

if($reflectionObj->hasProperty($property)) {

$reflectionProp = new \ReflectionProperty($entityClass, $property);
$relation = $reader->getPropertyAnnotation($reflectionProp, 'AppBundle\\Annotations\\Annotation\\Excel');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonne pratique : Excel::class plutot que la classe en dur

use JMS\Serializer\Annotation\VirtualProperty;
use JMS\Serializer\Annotation\MaxDepth;

use AppBundle\Annotations\Annotation\Excel;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca vaudrait presque le coup de direct faire un use AppBundle\Annotations\Annotation as App; comme ca si on en crée de nouvelles elles sont direct dispo

$list->addColumn(new Column('Date', function (PayementFile $file) use ($router) {
$this->addColumn(new Column('Date', function (PayementFile $file) use ($router) {
return $file->getDate();
},'date(global_datetime_format)'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faut qu'on crée un service qui contient tous les paramètres de ce type, qu'on stockerait en base de donnée et qu'on cacherait dès récupération initiale

@@ -46,7 +46,7 @@ public function getDefault($items, $url = null)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retourner un retour visuel sinon


public function generateExcel(AbstractList $list)
{
$workBook = new \PHPExcel();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utiliser le service fournis par le bundle de PHPExcel

{
$workBook = new \PHPExcel();

$workBook->setActiveSheetIndex(0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Et créer un service qui permet de générer des objets excels pré formatés (auteur, description...) de manière centralisée

* @param $contentType
* @return Response
*/
static function streamFile($fileContent,$fileName,$contentType)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le bundle https://github.com/liuggio/ExcelBundle fournis tout ca et plus encore

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Liste = > excel : de facon générique

2 participants