add publish to factory param
This commit is contained in:
parent
a00bbc3abb
commit
1f440bafad
|
@ -29,7 +29,7 @@ class Entity_Factory {
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \ErrorException
|
* @throws \ErrorException
|
||||||
*/
|
*/
|
||||||
public function create_entity($type, $args = [], $is_validated_and_in_db = false){
|
public function create_entity($type, $args = [], $is_validated_and_in_db = false, $publish = false){
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -55,6 +55,11 @@ class Entity_Factory {
|
||||||
$this->entity = new $this->entity_type();
|
$this->entity = new $this->entity_type();
|
||||||
$this->repository = new $this->repository_type();
|
$this->repository = new $this->repository_type();
|
||||||
|
|
||||||
|
if($publish)
|
||||||
|
{
|
||||||
|
$this->entity->set_status('publish');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($args) && $is_validated_and_in_db) {
|
if (!empty($args) && $is_validated_and_in_db) {
|
||||||
foreach ($args as $attribute => $content) {
|
foreach ($args as $attribute => $content) {
|
||||||
if($attribute == 'add_metadata'){
|
if($attribute == 'add_metadata'){
|
||||||
|
|
Loading…
Reference in New Issue