Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Coureau committed Sep 9, 2014
2 parents a3cafda + 6b5053d commit 4e7affd
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
25 changes: 16 additions & 9 deletions Model/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ abstract class Comment implements WordpressEntityInterface, WordpressContentInte
/**
* @var string
*/
protected $authorEmail;
protected $authorEmail = "";

/**
* @var string
*/
protected $authorUrl;
protected $authorUrl = "";

/**
* @var string
*/
protected $authorIp;
protected $authorIp = "";

/**
* @var \DateTime
Expand All @@ -67,32 +67,32 @@ abstract class Comment implements WordpressEntityInterface, WordpressContentInte
/**
* @var integer
*/
protected $karma;
protected $karma = 0;

/**
* @var string
*/
protected $approved;
protected $approved = 1;

/**
* @var string
*/
protected $agent;
protected $agent = "";

/**
* @var string
*/
protected $type;
protected $type = "";

/**
* @var Comment
*/
protected $parent;
protected $parent = 0;

/**
* @var User
*/
protected $user;
protected $user = 0;


/**
Expand Down Expand Up @@ -382,4 +382,11 @@ public function getUser()
{
return $this->user;
}

public function __construct()
{
$this->date = new \DateTime("0000-00-00");
$this->dateGmt = new \DateTime("0000-00-00");
}

}
9 changes: 9 additions & 0 deletions Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,13 @@ public function eraseCredentials()
{
return $this;
}

/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->getUsername();
}

}
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,33 @@ security:
entity: { class: Ekino\WordpressBundle\Entity\User, property: login }
```

### 3) Update your Wordpress index.php file to load Symfony libraries
### 3) Wrap code inside web/app.php and web/app_dev.php

To avoid problem with some Wordpress plugin, you need to wrap code inside a function like this :
```php
<?php
use Symfony\Component\HttpFoundation\Request;
// change for app_dev.php
function run(){
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
}
run();
```

And now do the same for app.php

### 4) Update your Wordpress index.php file to load Symfony libraries

```php
<?php
Expand Down Expand Up @@ -134,7 +160,7 @@ $sfResponse->send();
$sfKernel->terminate($sfRequest, $sfResponse);
```

### 4) Edit .htaccess file on your Wordpress root project directory
### 5) Edit .htaccess file on your Wordpress root project directory

Put the following rules:

Expand Down

0 comments on commit 4e7affd

Please sign in to comment.