add enzyme/axiom interfaces
use axiom/RepositoryInterface in tests and store music add axiom/Models/ModelInterface to TuneCollection
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: richard
|
||||
* Date: 10/16/17
|
||||
* Time: 6:14 AM
|
||||
*/
|
||||
|
||||
namespace XaiCorp\AbcParser\Interfaces;
|
||||
|
||||
|
||||
interface Repository
|
||||
{
|
||||
public function store($entity);
|
||||
|
||||
public function get($id);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace XaiCorp\AbcParser\Models\Memory;
|
||||
use XaiCorp\AbcParser\Interfaces\Builder;
|
||||
use XaiCorp\AbcParser\Interfaces\Exporter;
|
||||
use XaiCorp\AbcParser\Interfaces\Manipulator;
|
||||
use Enzyme\Axiom\Repositories\RepositoryInterface;
|
||||
|
||||
class Abc implements Builder
|
||||
{
|
||||
@@ -13,6 +14,22 @@ class Abc implements Builder
|
||||
|
||||
protected $currentSetting;
|
||||
|
||||
protected $tuneRepository;
|
||||
|
||||
protected $settingRepository;
|
||||
|
||||
protected $personRepository;
|
||||
|
||||
/**
|
||||
* @var \XaiCorp\AbcParser\Interfaces\Repository
|
||||
*/
|
||||
protected $collectionRepository;
|
||||
|
||||
public function __construct(RepositoryInterface $collectionRepository)
|
||||
{
|
||||
$this->collectionRepository = $collectionRepository;
|
||||
}
|
||||
|
||||
public function newCollection()
|
||||
{
|
||||
$this->collection = new TuneCollection();
|
||||
@@ -73,6 +90,8 @@ class Abc implements Builder
|
||||
$this->currentSetting->set('music', trim($music));
|
||||
$this->currentTune->append('collection', $this->currentSetting);
|
||||
$this->collection->append('collection', $this->currentTune);
|
||||
//TODO: save to repositories
|
||||
|
||||
// save to repositories
|
||||
$this->collectionRepository->add($this->collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace XaiCorp\AbcParser\Models\Memory;
|
||||
|
||||
use Enzyme\Axiom\Models\ModelInterface;
|
||||
|
||||
/**
|
||||
* TuneCollection represents a collection of tunes, such a book, manuscript
|
||||
* or abc file.
|
||||
@@ -8,7 +10,8 @@ namespace XaiCorp\AbcParser\Models\Memory;
|
||||
* a collection can have various parameters to define the collection
|
||||
* in addition to the list of tunes
|
||||
*/
|
||||
class TuneCollection extends BaseIterator {
|
||||
class TuneCollection extends BaseIterator implements ModelInterface
|
||||
{
|
||||
|
||||
private $tc_id = 0; // collection id
|
||||
private $cOwner; // collection owner. The user that uploaded it
|
||||
@@ -267,5 +270,47 @@ class TuneCollection extends BaseIterator {
|
||||
return md5(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique identity for this mode.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function identity()
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Checks whether this model has the given attribute set.
|
||||
*
|
||||
* @param string $attribute
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function has($attribute)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the value associated with the given attribute.
|
||||
// *
|
||||
// * @param string $attribute
|
||||
// *
|
||||
// * @return mixed
|
||||
// */
|
||||
// public function get($attribute)
|
||||
// {
|
||||
// //TODO:
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get all the attributes associated with this model.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user