/**
  * @testdox The meta data contains storage details
  */
 public function testGetMetaForArticleStorage()
 {
     $meta = $this->builder->getMeta(Article::class);
     $this->assertTrue(is_array($meta->storage));
     $this->assertEquals('default', $meta->storage['type']);
     $this->assertEquals('articles', $meta->storage['table']);
 }
示例#2
0
 /**
  * Gets the identifier for an entity
  *
  * @param   object  $entity  The entity
  *
  * @return  array  The identifier as key-value pair(s)
  */
 protected function getIdentifier($entity)
 {
     $entityId = json_decode($this->entityRegistry->getEntityId($entity), true);
     if (is_array($entityId)) {
         $identifier = [];
         foreach ($entityId as $key => $value) {
             $key = strtolower(Normalise::toUnderscoreSeparated(Normalise::fromCamelCase($key)));
             $identifier[$key] = $value;
         }
         return $identifier;
     }
     $primary = $this->builder->getMeta(get_class($entity))->primary;
     return [$primary => $entityId];
 }
 /**
  * Gets the meta data for an entity
  *
  * @param   object  $entity  The entity
  *
  * @return  \Joomla\ORM\Definition\Parser\Entity  The meta data
  */
 public function getMeta($entity)
 {
     return $this->builder->getMeta($this->getClassName($entity));
 }