From 4149f75204d624fca48169f46ff22544edd38e01 Mon Sep 17 00:00:00 2001 From: weryques Date: Wed, 6 Jun 2018 12:13:00 -0300 Subject: [PATCH] Fixes PHP Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) --- .../entities/class-tainacan-item-metadata-entity.php | 2 +- src/classes/repositories/class-tainacan-repository.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/classes/entities/class-tainacan-item-metadata-entity.php b/src/classes/entities/class-tainacan-item-metadata-entity.php index e1f90e0c9..a66d18552 100644 --- a/src/classes/entities/class-tainacan-item-metadata-entity.php +++ b/src/classes/entities/class-tainacan-item-metadata-entity.php @@ -30,7 +30,7 @@ class Item_Metadata_Entity extends Entity { * @param Field $field Field Entity * @param int $meta_id ID for a specific meta row */ - function __construct(Item $item, Field $field, $meta_id = null, $parent_meta_id = null) { + function __construct(Item $item = null, Field $field = null, $meta_id = null, $parent_meta_id = null) { $this->set_item($item); $this->set_field($field); diff --git a/src/classes/repositories/class-tainacan-repository.php b/src/classes/repositories/class-tainacan-repository.php index 2e3a17601..90570fe04 100644 --- a/src/classes/repositories/class-tainacan-repository.php +++ b/src/classes/repositories/class-tainacan-repository.php @@ -429,7 +429,8 @@ abstract class Repository { public static function get_entity_by_post_type( $post_type, $post = 0 ) { $prefix = substr( $post_type, 0, strlen( Entities\Collection::$db_identifier_prefix ) ); $item_metadata = Repositories\Item_Metadata::get_instance(); - $item_metadata_post_type = $item_metadata->entities_type; + $item_metadata_entity = new $item_metadata->entities_type(null, null); + $item_metadata_post_type = $item_metadata_entity::get_post_type(); // Is it a collection Item? if ( $prefix == Entities\Collection::$db_identifier_prefix ) { @@ -458,7 +459,9 @@ abstract class Repository { $Tainacan_Logs ]; foreach ( $tnc_globals as $tnc_repository ) { - $entity_post_type = $tnc_repository->entities_type::get_post_type(); + $tnc_entity = new $tnc_repository->entities_type(); + $entity_post_type = $tnc_entity::get_post_type(); + if ( $entity_post_type == $post_type ) { return new $tnc_repository->entities_type( $post ); }