src/Entity/Factory/MessageFactory.php
public function entity(array $data = [])
    {
        // @todo ここでnewするのなんとかしたい・・・
        $userFactory = new UserFactory();
        $message = new Message();

        $message->account = $userFactory->entity($data['account']);
        unset($data['account']);

        foreach ($data as $key => $value) {
            $property = Inflector::variable($key);
            $message->$property = $value;
        }

        return $message;
    }
public function entity(array $data = [])
    {
        // @todo ここでnewするのなんとかしたい・・・
        $userFactory = new UserFactory();
        $message = new Message();

        $message->account = $userFactory->entity($data['account']);
        unset($data['account']);

        foreach ($data as $key => $value) {
            $property = Inflector::variable($key);
            $message->$property = $value;
        }

        return $message;
    }
public function entity ( array $ data = [ ] ) { // @todo ここでnewするのなんとかしたい・・・ $ userFactory = new UserFactory ( ) ; $ message = new Message ( ) ; $ message -> account = $ userFactory -> entity ( $ data [ 'account' ] ) ; unset ( $ data [ 'account' ] ) ; foreach ( $ data as $ key => $ value ) { $ property = Inflector :: variable ( $ key ) ; $ message -> $ property = $ value ; } return $ message ; }
@param array $data

@return Message
@param array $data