Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added createReader as xls.load_xls5 service #8

Merged
merged 1 commit into from May 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -120,6 +120,13 @@ class DefaultController extends Controller

```

If you want read xls if your controller:

``` php
$exelObj = $this->get('xls.load_xls5')->load($filename);

```


## ADVANCED USE

Expand Down
11 changes: 11 additions & 0 deletions Resources/config/services.yml
Expand Up @@ -18,6 +18,16 @@ services:
factory_class: %xls.factory.class%
factory_method: createWriter
arguments: [@xls.phpexcel, "Excel5"]

#reader for xls5
xls.load_xls5:
class: %xls.factory5.method%
factory_class: %xls.factory.class%
factory_method: createReader
arguments: ["Excel5"]



#setter injection
xls.stream_writer_output_xls5:
class: %xls.stream_writer.class%
Expand All @@ -29,6 +39,7 @@ services:
xls.service_xls5:
class: %xls.service.class%
arguments: [@xls.phpexcel, @xls.stream_writer_output_xls5, %xls.stream_response.class%]


# if you need to create another PHP object
#factory for another format
Expand Down
17 changes: 7 additions & 10 deletions Service/ExcelContainer.php
Expand Up @@ -12,37 +12,37 @@ class ExcelContainer
* @var
*/
public $excelObj;

/**
* @var
*/
protected $stream_writer;

/**
* @var
*/
protected $response_service;


/**
* @param $excelObj
* @param $factory_writer
* @param string $factory_write_method
* @param $stream_writer
* @param $response_service
*/

public function __construct($excelObj, $stream_writer, $response_service)
{
$this->setExcelObj($excelObj);
$this->setStreamWriter($stream_writer);
$this->setResponseService($response_service);

}

/*
* create the response with the file content
*
* @return \Symfony\Component\HttpFoundation\Response
*/
* create the response with the file content
*
* @return \Symfony\Component\HttpFoundation\Response
*/

public function getResponse()
{
$responsiveClass = $this->getResponseService();
Expand Down Expand Up @@ -71,8 +71,6 @@ public function getExcelObj()
return $this->excelObj;
}



/**
* @param $response_service
*/
Expand Down Expand Up @@ -105,5 +103,4 @@ public function getStreamWriter()
return $this->stream_writer;
}


}