archive-com.com » COM » S » SOLARPHP.COM

Total: 875

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Solar Framework for PHP 5
    is expressed as an array element where the key is a regular expression patterns to match against incoming URIs The element value indicates how to rewrite the matched URI These are used as the first two parameters to a preg replace call Here is an example config file value for a short form rewrite rule in the front controller php blog 88 edit gets rewritten as blog edit 88 pattern blog d edit rewrite blog edit 1 config Solar Controller Front rewrite pattern rewrite 2 3 2 Replacement Tokens You can also define replacement tokens for the regular expressions this lets you predefine certain expression parts and reuse them in an easier to read way The front controller defines a number of replacements but you can add your own as well php Solar Uri Rewrite defines the following by default action a z alpha a zA Z alnum a zA Z0 9 controller a z digit 0 9 param params slug a zA Z0 9 word a zA Z0 9 you can add your own regex replacement strings as well config Solar Controller Front replace array product slug d a zA Z product 123 foobar view gets rewritten as catalog show item 123 foobar pattern product product slug view rewrite catalog show item 1 config Solar Controller Front rewrite pattern rewrite Note In a short form rule the replacement tokens have no semantic meaning and are not parameter keywords They are used only as easy to read placeholders for reusable regular expression pieces 2 3 3 Long Form In the long form a rewrite rule is still expressed as an array element However the element key is a name for the rule and the element value is sub array of processing instructions We call this a named action or a

    Original URL path: http://solarphp.com/manual/dispatch-cycle.rewrite-rules (2016-02-13)
    Open archived version from archive


  • Solar Framework for PHP 5
    URI but only if that format will be recognized by the action method If the format is not recognized it will be appended to the last info element instead You can tell a method to recognize a particular format extension using the action format array where the key is the action name and the value is an array of recognized format extensions For example take a URI of blog read 123 foo rss If action format read array rss that means the actionRead method should recognize the rss request and so you will get format rss But if action format does not have that entry format will be empty and the actionRead will be passed parameters of 123 foo rss instead of just 123 foo layout This specifies what layout template name to use in the 2 step view process When format is non empty layout will be set to null automatically This is to indicate that a non standard format is being requested such as XML or RSS the views for these non standard requests generally do not need a layout wrapped around them query This is an array of the query terms and values from the incoming URI For example the query string foo bar baz dib would become query array foo bar baz dib 2 4 2 Running the Action Here is a brief outline of what occurs when running the requested action The preRun method is invoked which may change the properties as loaded by the above setup logic The preAction hook runs In the next step the action method might forward to other actions so this hook will execute each time forwarding occurs The action method itself runs using action to determine which method that should be and using the parameters from the URI as stored in info This is where the center of the logic for the action is written by the developer For example given a URI of blog read 123 foo the system will end up calling Vendor App Blog actionRead 123 foo The postAction hook runs In the previous step the action method might have called forward to other actions so this hook will execute each time forwarding occurs Finally the postRun method is invoked which may change the results of the properties as manipulated by the action s 2 4 3 Rendering the Results Here is a brief outline of what occurs when rendering the results of the requested action The setViewObject method sets up a Solar View object for the rendering process In doing so it adds the template path stack for views and a stack of class prefixes for view helpers It also injects some special variables into the view to wit controller class controller action layout format and errors After the view object is set up the rendering process calls the preRender method so you can modify the view object or the page controller properties before rendering occurs The page controller assigns all of its own public

    Original URL path: http://solarphp.com/manual/dispatch-cycle.page-controller (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    5 2 Collection Objects 3 6 Record Creation Modification and Saving 3 6 1 Creating a New Record 3 6 2 Modifying A Record 3 6 3 Saving A Record 3 7 Record Filters 3 7 1 Automatic Filters 3 7 2 Adding Filters 3 7 3 Available Sanitize Filters 3 7 4 Available Validate Filters 3 8 Special Column Processing 3 8 1 Created Timestamp 3 8 2 Updated

    Original URL path: http://solarphp.com/manual/model (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    whatever reason you can fall back to using the Solar Sql Select class a QueryObject implementation or even to the lower level Solar Sql Adapter system based on PDO The model system itself uses those classes for its foundations In this chapter we will go over the components of the model system and the design patterns to which they correspond how to retrieve a model object from the model catalog

    Original URL path: http://solarphp.com/manual/model.intro (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    This looks a bit like ActiveRecord but depends on the model mapper object for database interactions so it s not an ActiveRecord proper Solar Sql Model Collection represents a collection of record objects from the same model Solar Sql Model Related describes the relationships between models and is responsible for coordinating the retrieval of related data It uses such patterns as ForeignKeyMapping and AssociationTableMapping Finally Solar Sql Model Catalog provides

    Original URL path: http://solarphp.com/manual/model.components (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    same model instance can be reused each time you need it 3 3 1 Creating A Catalog Instance To use a catalog of course you need an instance of it By default the Solar system registers a Solar Sql Model Catalog object for lazy loading under the name model catalog You can retrieve it like so php model Solar Registry get model catalog As a matter of convention we call the model catalog model or catalog depending on the context You can call it anything you like in your own scripts without harm but as a matter of vocabulary we recommend sticking with the convention 3 3 2 Retrieving A Model From The Catalog Now that we have a model catalog we can use it to retrieve model object instances It is almost as easy as this php get the catalog model Solar Registry get model catalog get the blogs model from the catalog blogs model blogs However there is one catch you have to tell the catalog where the model classes are Recall from the blog demo chapter that we had to configure Solar Sql Model Catalog in the config file like so php config Solar Sql Model Catalog

    Original URL path: http://solarphp.com/manual/model.catalog (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    OR bar bar GROUP BY columns group array zim id HAVING conditions having array total total ORDER BY columns order array total you can use regular LIMITs limit array count offset or let the model calculate a page based LIMIT page page number paging rows per page do a followup query without limits to get a page count count pages true bind these placeholder values to the query bind array bar bar fetch a collection using the fetch params list model blogs fetchAll fetch alias Normally the model will use the table name without an alias in the SELECT query it generates However you can use this to specify an alias In the above example this would generate FROM blogs AS zim cols Normally the model will fetch all table columns You can use this to specify which columns to select including computed columns where This is an array of conditions for the WHERE clause The elements each take one of two forms The first is a single value passed literally as the condition The second is a key value pair where the key has one or more placeholders in it the value is then quoted against SQL injection and placed into the condition immediately group Indicates a GROUP BY clause using these columns having As with where this is an array of conditions for the HAVING clause order Indicates an ORDER BY clause using these columns limit This can be an integer indicating a LIMIT count or it can be an array of two elements indicating a LIMIT count and offset This parameter overrides the page and paging values page When combined with paging this will fetch the indicated page number of the result set paging Indicates to page how many result rows per page it should use when

    Original URL path: http://solarphp.com/manual/model.fetch (2016-02-13)
    Open archived version from archive

  • Solar Framework for PHP 5
    label htmlspecialchars col value htmlspecialchars val echo label value br echo the ID as a property or as an array element echo item id is the same as item id You can also call any methods that exist on the record object that would be the way to implement any record level business logic for your domain 3 5 2 Collection Objects Like records the collection object also extends Solar Struct This means that you can treat the collection much like an array when it s convenient php a collection of blog records list model blogs fetchAll print the title of each blog entry note that n is a sequential array key not the primary key value foreach list as n blog echo Primary key ID htmlspecialchars blog id is titled htmlspecialchars blog title br how many records are in the collection count count list using fetchAssoc will key the collection on the first column of the results in this case becasue id is the first column the array key and the primary key are the same thing list model blogs fetchAssoc foreach list as key blog echo Primary key ID htmlspecialchars blog id is the same as the assoc key htmlspecialchars key br Note Collections receive all the data for their record objects at instantiation time but they don t create a record object until you ask for it The collection object has a few methods that let you get information about the collection as a whole getPrimaryVals Returns an array of the unique primary keys contained in this collection Does not trigger record object creation it uses the internal results data array only getColVals colname Returns an array of all values for a single column in the collection This does trigger record object creation since the requested column

    Original URL path: http://solarphp.com/manual/model.results (2016-02-13)
    Open archived version from archive



  •