Skip to content

Commit 1e7bedf

Browse files
committed
Create Factory Stubs for PHP 7.0
1 parent 80d303f commit 1e7bedf

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace {{ FactoryNamespace }};
4+
5+
use {{ EntityNamespace }}\{{ EntityName }};
6+
use stdClass;
7+
8+
class {{ FactoryName }} extends Factory
9+
{
10+
/**
11+
* @param stdClass $entity
12+
* @return {{ EntityName }}
13+
*/
14+
public function makeEntityFromStdClass($entity)
15+
{
16+
${{ EntityVariableName }} = new {{ EntityName }}();
17+
18+
19+
return ${{ EntityVariableName }};
20+
}
21+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
${{ EntityVariableName }}->set{{ SetterName }}($entity->{{ AttributeName }} ?? null);

0 commit comments

Comments
 (0)