Catchable fatal error: Argument 1 passed to Core\Model\Mapper\PostMapper::save() must be an instance of Core\Model\Mapper\Post, instance of Core\Model\Post given, called in C:\wamp\www\Test\index.php on line 16 and defined in C:\wamp\www\Test\Core\Model\Mapper\PostMapper.php on line 15
index.php
<?php
require_once 'Core/Library/SplClassLoader.php';
$loader = new SplClassLoader('Core', '');
$loader->register();
use Core\Model\Post,
Core\Model\Mapper\PostMapper;
$db = false;
$postMapper = new PostMapper($db);
$post = new Post;
$postMapper->save($post);
PostMapper インターフェイスと PostMapper には「Post」があります
<?php
namespace Core\Model\Mapper;
interface PostMapperInterface
{
public function save(Post $post);
}
「投稿」ではないことに文句を言う理由がわかりません