コード例 #1
0
    {
        return print_r($this->conditions, true);
    }
    public function store(EntityInterface $entity)
    {
        echo "Storing {$entity->type()}#{$entity->id}\n";
    }
    public function delete(EntityInterface $entity)
    {
        echo "Deleting {$entity->type()}#{$entity->id}\n";
    }
}
$locator = new Locator([new RecursiveDirectoryStrategy(__DIR__)]);
$repository = new Repository('Article', $locator);
/** @var Entity $entity */
$entity = $repository->create();
echo "\nInternal structure:\n";
print_r($entity->getDefinition());
echo "\nResetting\n";
$entity = $repository->create();
echo "\nbelongTo: ";
print_r($entity->parent);
echo "\n";
echo "\nSetting parent_id = 23\n";
$entity->parent_id = '23';
echo "\nbelongsTo (first access): ";
print_r($entity->parent);
echo "\nbelongsTo (other access): ";
print_r($entity->parent);
echo "\nResetting\n";
$entity = $repository->create();