Commit 5d6a6432 authored by Bas de Nooijer's avatar Bas de Nooijer

Added new event classes

parent ec730ab5
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
/**
* Event definitions
*/
class Events
{
/**
* The preCreateRequest event is thrown just before a request is created based on a query object, using the
* requestbuilder.
*
* The event listener receives a QueryInterface instance.
*
* @var string
*/
const PRE_CREATE_REQUEST = 'solarium.core.preCreateRequest';
/**
* The postCreateRequest event is thrown just after a request has been created based on a query object, using the
* requestbuilder.
*
* The event listener receives a QueryInterface instance and a Request instance.
*
* @var string
*/
const POST_CREATE_REQUEST = 'solarium.core.postCreateRequest';
/**
* The preExecuteRequest event is thrown just before a request is sent to Solr
*
* The event listener receives a Request instance.
*
* @var string
*/
const PRE_EXECUTE_REQUEST = 'solarium.core.preExecuteRequest';
/**
* The postExecuteRequest event is thrown just after a request has been sent to Solr.
*
* The event listener receives a Request instance and a Response instance.
*
* @var string
*/
const POST_EXECUTE_REQUEST = 'solarium.core.postExecuteRequest';
/**
* The preCreateResult event is before the Solr response data is parsed into a result object
*
* The event listener receives a Query and a Response instance.
*
* @var string
*/
const PRE_CREATE_RESULT = 'solarium.core.preCreateResult';
/**
* The postCreateResult event is thrown just after the Solr response data was parsed into a result object
*
* The event listener receives a Query, Response and Result instance.
*
* @var string
*/
const POST_CREATE_RESULT = 'solarium.core.postCreateResult';
/**
* The preExecute event is thrown as soon as the Solarium client execute method is called. This method
* calls the createRequest, executeRequest and createResponse methods. Using this event you can override
* the standard execution flow.
*
* The event listener receives a Query instance.
*
* @var string
*/
const PRE_EXECUTE = 'solarium.core.preExecute';
/**
* The postExecute event is thrown just after a all execution is done.
*
* The event listener receives a Query instance and a Result instance.
*
* @var string
*/
const POST_EXECUTE = 'solarium.core.postExecute';
/**
* The preCreateQuery event is thrown before the creation of a new query object. Using this event you can
* for instance customize the returned query.
*
* The event listener receives a QueryType string and an Options array.
*
* @var string
*/
const PRE_CREATE_QUERY = 'solarium.core.preCreateQuery';
/**
* The postCreateQuery event is thrown after the creation of a new query object. Using this event you can
* for instance customize the returned query.
*
* The event listener receives a querytype string, an Options array and the resulting QueryType instance.
*
* @var string
*/
const POST_CREATE_QUERY = 'solarium.core.postCreateQuery';
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
/**
* PostCreateQuery event, see Events for details
*/
class PostCreateQuery extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var string
*/
protected $type;
/**
* @var array
*/
protected $options;
/**
* Event constructor
*
* @param string $type
* @param array $query
* @param QueryInterface $query
*/
public function __construct($type, $options, QueryInterface $query)
{
$this->type = $type;
$this->options = $options;
$this->query = $query;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the querytype for this event
*
* @return string
*/
public function getQueryType()
{
return $this->type;
}
/**
* Get the options for this event
*
* @return string
*/
public function getOptions()
{
return $this->options;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Client\Request;
/**
* PostCreateRequest event, see Events for details
*/
class PostCreateRequest extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var Request
*/
protected $request;
/**
* Event constructor
*
* @param QueryInterface $query
*/
public function __construct(QueryInterface $query, Request $request)
{
$this->query = $query;
$this->request = $request;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the request object for this event
*
* @return Request
*/
public function getRequest()
{
return $this->request;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\ResultInterface;
/**
* PostCreateResult event, see Events for details
*/
class PostCreateResult extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var Response
*/
protected $response;
/**
* @var ResultInterface
*/
protected $result;
/**
* Event constructor
*
* @param QueryInterface $query
* @param Response $response
* @param ResultInterface $result
*/
public function __construct(QueryInterface $query, Response $response, ResultInterface $result)
{
$this->query = $query;
$this->response = $response;
$this->result = $result;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the response object for this event
*
* @return Response
*/
public function getResponse()
{
return $this->response;
}
/**
* Get the result object for this event
*
* @return ResultInterface
*/
public function getResult()
{
return $this->result;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Query\Result\ResultInterface;
/**
* PostExecute event, see Events for details
*/
class PostExecute extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var ResultInterface
*/
protected $result;
/**
* Event constructor
*
* @param QueryInterface $query
* @param ResultInterface $result
*/
public function __construct(QueryInterface $query, ResultInterface $result)
{
$this->query = $query;
$this->result = $result;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the result object for this event
*
* @return ResultInterface
*/
public function getResult()
{
return $this->result;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Client\Request;
use Solarium\Core\Client\Response;
use Solarium\Core\Client\Endpoint;
/**
* PostExecuteRequest event, see Events for details
*/
class PostExecuteRequest extends Event
{
/**
* @var Request
*/
protected $request;
/**
* @var Endpoint
*/
protected $endpoint;
/**
* @var Response
*/
protected $response;
/**
* Event constructor
*
* @param Request $request
* @param Endpoint $endpoint
* @param Response $response
*/
public function __construct(Request $request, Endpoint $endpoint, Response $response)
{
$this->request = $request;
$this->endpoint = $endpoint;
$this->response = $response;
}
/**
* Get the endpoint object for this event
*
* @return Endpoint
*/
public function getEndpoint()
{
return $this->endpoint;
}
/**
* Get the response object for this event
*
* @return Response
*/
public function getResponse()
{
return $this->response;
}
/**
* Get the request object for this event
*
* @return Request
*/
public function getRequest()
{
return $this->request;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
/**
* PreCreateQuery event, see Events for details
*/
class PreCreateQuery extends Event
{
/**
* @var null|QueryInterface
*/
protected $query;
/**
* @var string
*/
protected $type;
/**
* @var array
*/
protected $options;
/**
* Event constructor
*
* @param string $type
* @param array|null $query
*/
public function __construct($type, $options)
{
$this->type = $type;
$this->options = $options;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Set the query object for this event, this overrides default execution
*
* @param QueryInterface $query
* @return void
*/
public function setQuery($query)
{
$this->query = $query;
}
/**
* Get the querytype for this event
*
* @return string
*/
public function getQueryType()
{
return $this->type;
}
/**
* Get the options for this event
*
* @return array|null
*/
public function getOptions()
{
return $this->options;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Client\Request;
/**
* PreCreateRequest event, see Events for details
*/
class PreCreateRequest extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var Request
*/
protected $request;
/**
* Event constructor
*
* @param QueryInterface $query
*/
public function __construct(QueryInterface $query)
{
$this->query = $query;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Set request
*
* If you set this request value the default execution is skipped and this request is directly returned
*
* @param Request $request
* @return void
*/
public function setRequest(Request $request)
{
$this->request = $request;
}
/**
* Get the result
*
* @return null|Request
*/
public function getRequest()
{
return $this->request;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Client\Response;
use Solarium\Core\Query\Result\ResultInterface;
/**
* PreCreateResult event, see Events for details
*/
class PreCreateResult extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var Response
*/
protected $response;
/**
* @var ResultInterface
*/
protected $result;
/**
* Event constructor
*
* @param QueryInterface $query
* @param Response $response
*/
public function __construct(QueryInterface $query, Response $response)
{
$this->query = $query;
$this->response = $response;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the response object for this event
*
* @return Response
*/
public function getResponse()
{
return $this->response;
}
/**
* Get the result object for this event
*
* @return ResultInterface
*/
public function getResult()
{
return $this->result;
}
/**
* Set the result object for this event, overrides default execution
*
* @param ResultInterface $result
* @return void
*/
public function setResult($result)
{
$this->result = $result;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Query\QueryInterface;
use Solarium\Core\Query\Result\ResultInterface;
/**
* PostExecute event, see Events for details
*/
class PreExecute extends Event
{
/**
* @var QueryInterface
*/
protected $query;
/**
* @var ResultInterface
*/
protected $result;
/**
* Event constructor
*
* @param QueryInterface $query
*/
public function __construct(QueryInterface $query)
{
$this->query = $query;
}
/**
* Get the query object for this event
*
* @return QueryInterface
*/
public function getQuery()
{
return $this->query;
}
/**
* Get the result object for this event
*
* @return ResultInterface
*/
public function getResult()
{
return $this->result;
}
/**
* Set the result object for this event, overrides default execution
*
* @param ResultInterface $result
* @return void
*/
public function setResult($result)
{
$this->result = $result;
}
}
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*/
/**
* @namespace
*/
namespace Solarium\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Solarium\Core\Client\Request;
use Solarium\Core\Client\Response;
use Solarium\Core\Client\Endpoint;
/**
* PreExecuteRequest event, see Events for details
*/
class PreExecuteRequest extends Event
{
/**
* @var Request
*/
protected $request;
/**
* @var Endpoint
*/
protected $endpoint;
/**
* @var Response
*/
protected $response;
/**
* Event constructor
*
* @param Request $request
* @param Endpoint $endpoint
*/
public function __construct(Request $request, Endpoint $endpoint)
{
$this->request = $request;
$this->endpoint = $endpoint;
}
/**
* Get the endpoint object for this event
*
* @return Endpoint
*/
public function getEndpoint()
{
return $this->endpoint;
}
/**
* Get the request object for this event
*
* @return Request
*/
public function getRequest()
{
return $this->request;
}
/**
* Get the request object for this event
*
* @param Request $request
* @return void
*/
public function setRequest($request)
{
$this->request = $request;
}
/**
* Get the response object for this event
*
* @return Response
*/
public function getResponse()
{
return $this->response;
}
/**
* Set the response object for this event, overrides default execution
*
* @param Response $response
* @return void
*/
public function setResponse($response)
{
$this->response = $response;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment