-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow association and virtual field handling
- Loading branch information
1 parent
2337185
commit 3ed7b63
Showing
28 changed files
with
473 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
/* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Avro\CsvBundle\Event; | ||
|
||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* Row association event. | ||
* | ||
* @author Steffen Roßkamp <[email protected]> | ||
*/ | ||
class AssociationFieldEvent extends Event | ||
{ | ||
protected $object; | ||
protected $associationMapping; | ||
protected $row; | ||
protected $fields; | ||
protected $headers; | ||
protected $index; | ||
|
||
/** | ||
* @param object $object | ||
* @param array $associationMapping | ||
* @param array $row | ||
* @param array $fields | ||
* @param array $headers | ||
* @param int $index | ||
*/ | ||
public function __construct(object $object, array $associationMapping, array $row, array $fields, array $headers, int $index) | ||
{ | ||
$this->object = $object; | ||
$this->associationMapping = $associationMapping; | ||
$this->row = $row; | ||
$this->fields = $fields; | ||
$this->headers = $headers; | ||
$this->index = $index; | ||
} | ||
|
||
/** | ||
* @return object | ||
*/ | ||
public function getObject(): object | ||
{ | ||
return $this->object; | ||
} | ||
|
||
/** | ||
* Get field association mapping. | ||
* | ||
* @return array | ||
*/ | ||
public function getAssociationMapping(): array | ||
{ | ||
return $this->associationMapping; | ||
} | ||
|
||
/** | ||
* Get field row. | ||
* | ||
* @return array | ||
*/ | ||
public function getRow(): array | ||
{ | ||
return $this->row; | ||
} | ||
|
||
/** | ||
* Get mapped fields. | ||
* | ||
* @return array | ||
*/ | ||
public function getFields(): array | ||
{ | ||
return $this->fields; | ||
} | ||
|
||
/** | ||
* Get CSV headers. | ||
* | ||
* @return array | ||
*/ | ||
public function getHeaders(): array | ||
{ | ||
return $this->headers; | ||
} | ||
|
||
/** | ||
* Get the current field index. | ||
* | ||
* @return int | ||
*/ | ||
public function getIndex(): int | ||
{ | ||
return $this->index; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
/* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Avro\CsvBundle\Event; | ||
|
||
use ReflectionClass; | ||
use Symfony\Component\EventDispatcher\Event; | ||
|
||
/** | ||
* Row association event. | ||
* | ||
* @author Steffen Roßkamp <[email protected]> | ||
*/ | ||
class CustomFieldEvent extends Event | ||
{ | ||
protected $object; | ||
protected $reflectionClass; | ||
protected $row; | ||
protected $fields; | ||
protected $headers; | ||
protected $index; | ||
|
||
/** | ||
* @param object $object | ||
* @param ReflectionClass $reflectionClass | ||
* @param array $row | ||
* @param array $fields | ||
* @param array $headers | ||
* @param int $index | ||
*/ | ||
public function __construct(object $object, ReflectionClass $reflectionClass, array $row, array $fields, array $headers, int $index) | ||
{ | ||
$this->object = $object; | ||
$this->reflectionClass = $reflectionClass; | ||
$this->row = $row; | ||
$this->fields = $fields; | ||
$this->headers = $headers; | ||
$this->index = $index; | ||
} | ||
|
||
/** | ||
* @return object | ||
*/ | ||
public function getObject(): object | ||
{ | ||
return $this->object; | ||
} | ||
|
||
/** | ||
* Get object reflection class. | ||
* | ||
* @return ReflectionClass | ||
*/ | ||
public function getReflectionClass(): ReflectionClass | ||
{ | ||
return $this->reflectionClass; | ||
} | ||
|
||
/** | ||
* Get field row. | ||
* | ||
* @return array | ||
*/ | ||
public function getRow(): array | ||
{ | ||
return $this->row; | ||
} | ||
|
||
/** | ||
* Get mapped fields. | ||
* | ||
* @return array | ||
*/ | ||
public function getFields(): array | ||
{ | ||
return $this->fields; | ||
} | ||
|
||
/** | ||
* Get CSV headers. | ||
* | ||
* @return array | ||
*/ | ||
public function getHeaders(): array | ||
{ | ||
return $this->headers; | ||
} | ||
|
||
/** | ||
* Get the current field index. | ||
* | ||
* @return int | ||
*/ | ||
public function getIndex(): int | ||
{ | ||
return $this->index; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.